From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

passing global variables

I am currently using Station Globals for sharing values among the main sequence and subsequence files. But I constantly need to add the variables on the many computers we own.

I tried using the File Globals in the main sequence file, but the variables are not displayed in or passed to the subsequence file. It works just like a local variable.

I also tried selecting the option "propagnate to subsequence" for the local variable in the main sequence, but still didn't get passed to the subsequence.

 

Thanks!

 

ph2

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

You should use parameters in the subsequences and pass the locals, values or fileglobals down to them.  That is the correct way to get data in subsequences anyhow.

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 11
(5,169 Views)

Thanks Jigg !

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

The file globals should work the way you want it ( scope valid accross all sub sequences including main sequence of a sequence file).

The file globals are meant for this purose so maybe you are missing something?

 

As for using station globals it should always be dynamically generated by your test sequence if not exist.This way it can be used across computers.

0 Kudos
Message 4 of 11
(5,156 Views)

Hi

In this thread there one of the best explanation in the forums about variables.

Just see Rays anwesers. http://forums.ni.com/t5/NI-TestStand/Using-variables-in-TestStand-4-0/m-p/658815

 

To Jigg: I knew that you also have provied a great resoucre, but i did not found it -sorry!

Maybe you can provide link to your thread.

 

Regards

Juergen

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

SunRS,

 

Not sure what I'm missing for File Globals.  I added a variable under the Sequence File Globals view of the main sequence file, called the subsequence and expected to see the variable x ( much the same way it works for station globals).

 

Do I need to add a parameter or local x in the subsequence file to accept the file global passed from main sequence?

 

Thanks!

0 Kudos
Message 6 of 11
(5,145 Views)

One way in which you could do this with less changes is by adding the station globals dynamically when you start the main sequence you are running, something like a statement step with the following statement:

 

StationGlobals.SetValString("MyStationGlobal", PropOption_InsertIfMissing, "My Value!")

 

And then all the sequences run after that will have the variable on all machines you run.

 

Hope this helps,

Francisco

0 Kudos
Message 7 of 11
(5,143 Views)

@ph2 wrote:

I am currently using Station Globals for sharing values among the main sequence and subsequence files. But I constantly need to add the variables on the many computers we own.

I tried using the File Globals in the main sequence file, but the variables are not displayed in or passed to the subsequence file. It works just like a local variable.

I also tried selecting the option "propagnate to subsequence" for the local variable in the main sequence, but still didn't get passed to the subsequence.

 

Thanks!

 

ph2


I'd recommend you consider using sequence parameters rather than globals. If you use globals, and you someday want to switch to a multi-socket test system, you might have to make signficant changes to your code because you likely would not want all of the threads using the same globals. If you use parameters instead, then every thread already would automatically have its own copy of the variables. Also parameters do not have the problem you are asking about here.

 

-Doug

0 Kudos
Message 8 of 11
(5,139 Views)

Thanks to All for the help!  Those are all good resources.

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

file globals will be there if the sequence is in the current file, is this the case  for the sequence you are calling?

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