NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to find unused variable through sequence

Hi,

 

I would like to know if it is possible to find unused variable through sequence in order to suppress them ?

 

Thank you

0 Kudos
Message 1 of 11
(5,826 Views)

Hi,

 

If you are using TS 2010 or later, under  Menu->Debug->SequneceAnalyser there is Analyse "xxxSequenceFilexxx".

With it you are able to find unused stuff.

 

Regards

Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 2 of 11
(5,824 Views)

I use TS 4.2 2009. Is there another way?

0 Kudos
Message 3 of 11
(5,818 Views)

I used to do a search for the variable.  You can limit the search to a single sequence if you are looking for a local.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 11
(5,804 Views)

Ok difficulty comes with many variables declared and not used in the project I have to finish.

 

Doing a manual search of all variables will take time

0 Kudos
Message 5 of 11
(5,799 Views)

niva wrote:

Doing a manual search of all variables will take time


It's not really a manual search.  There is a search tool and you can limit the search to a single sequence.  But yes, you will have to do the search one variable at a time.  This is exactly why I was excited when I got to upgrade TestStand and found the sequence analyzer.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 11
(5,796 Views)

If you have access to a newer version of TestStand you could use it just to determine which variables are unused and then go back to the older version to actually make the edits to the  file.

 

-Doug

Message 7 of 11
(5,788 Views)
Hi,
If you're fixed on that version of TestStand for a while (for whatever reason) and you see this situation coming up again, you could always build a small tool to automate the process.
From the current sequence file's handle, you could traverse all the locals and file globals to make a list of all variables and then search the sequences step by step to see if they're in use.
What this won't tell you is if any code modules or custom step types are directly accessing those variables through the sequencecontext handle so removing them can cause issues.
A secondary approach is to cut all the locals (or whatever the variable scope is) in to a new sequence file (or work with a backup version of your sequence file) and delete them from the existing file and see what errors get thrown up.
Finally, as Doug suggests, to get a latest copy of TestStand on to another machine, you could download a trial version and work with that if it's a one off. After all - if you find the sequence analyser feature that useful, it's a great reason to consider your upgrade policy / timing in the future anyway!
Thanks
Sacha
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 8 of 11
(5,775 Views)

I think I will do this automation to search all unsed vars 'cause I will be to the same version for a long

 

Just suprised that it does not exist.

Thank you

0 Kudos
Message 9 of 11
(5,743 Views)

I have tried this example that works fine on a local seq file (In directoriesAndFilesPath I have entered C:\pathtoseqfile\myseqfile.seq)

 

But if I search for words as Locals.myVar, the search does not find myVar as parameter of one TS method.

 

 

 

 SearchString.png

0 Kudos
Message 10 of 11
(5,644 Views)