NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving the dynamically created Local variables

Hi All,

I have created Local variable dynamically from C# code(Using Sequence context of sequence file). The variable created get deleted as soon as the sequence file complete execution.
Can anybody help me with a sample C# code or Knowledgebase for  making the local variable persist after sequence file  complete execution?

Thanks in Advance

Regards
VDC
0 Kudos
Message 1 of 5
(3,871 Views)

Hi VDC,

Ray Farmer has done a great answer about Varaibles a few hours a ago take a look
into it.

 http://forums.ni.com/ni/board/message?board.id=330&thread.id=18389

It seems that you have to use StationGlobals.

Other Solution:
It depends on the task you have to do. In my tasks that deals withs this topic i do it with XML.
At the beginning there is ActionCodemodule as DLL which loads the XML and load values for the locals.
At the end the values are saved back to the XML file.
If data are often need they are reloaded from the XML-DOM object as long as TS is running.

greetings

juergen

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

Hi VDC,

I have forgotten to mention an other solution. The PropertyObjectFile and Serailization
A few days ago i a have started a thread dealing with saving the result list as binary file.
By the way you can use this technics by all at kind of variables.

Just save your variables and their values to file drive an relaod them on demand.

Take a look into this thread http://forums.ni.com/ni/board/message?board.id=330&thread.id=18207

 

Hope this helps.

Greetings

juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 3 of 5
(3,852 Views)
Hi j_dodek,

sorry for the late reply,as i was struck up with some other work. Thanks for the timely suggestion,but can you pleae elaborate the solution little more as i didn't get you.


Regards
VDC
0 Kudos
Message 4 of 5
(3,790 Views)
The easiest way to do this is to add the flag PropFlags_Shared to your local variable.  However, if you ever run multiple sequences at the same time, they will all have the same instance of the variable.  This might not be what you want, since one sequence will change a variable, then another will change it back.  If you want to add a local variable to the edit-time copy of the sequence, you need to access the edit-time copy, rather than the execution copy.  I don't know exactly how your application is set up, so I'd need more information to help you further.  TestStand has an edit-time copy of a sequence that is copied each time you start a new execution.  This prevents multiple executions from interfering with each other if you are doing any parallel testing.

Allen P.
NI
0 Kudos
Message 5 of 5
(3,782 Views)