NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET get ThisContext

Hi,

 

I'm trying to get the ThisContext object of a specific sequence.

 

I'm using :

 

var = (Sequence)propertyObj.GetPropertyObject("RunState.SequenceFile.Data.Seq[1]", 0); to go to the specific sequence from the main sequence but I want to get to the selected sequence ThisContext object

0 Kudos
Message 1 of 8
(251 Views)

You want the to use ThisContext in a code module?  The best way is to just pass the context as a parameter to your code.

0 Kudos
Message 2 of 8
(233 Views)

In my code I want to load the limits to all of my sequences in one run. so, I need the ThisContex object of each sequence. 

 

My problem with the example I provided is that when I run the code in this way the TestStand will insert the limits after it finish running (so it will do the testing of the previous limits and not the new one). 

0 Kudos
Message 3 of 8
(223 Views)

Hello,

 

TestStand provides a 'build-in' mecanism to load dynamically properties - and Limits of your test sequence are properties. See Import Properties from Excel in TestStand using Property Loader Step

 

The Property Loader is a tool that you can use from the Sequence Editor to import and export properties values, AND you can alose use the Property Loader step type to import property values at run-time - values that you may have edited from the exported file. Differents file format are available (Excel is not the only one).

 

Pick a look in TestStand Example, I guess there is one to illustrate Property Loader step usage.

 

This may address your need - whithout reinventing the wheel?

 

Hope this could helps,

Message 4 of 8
(218 Views)

My supervisors want it to work for json files only... is there a solution? 

0 Kudos
Message 5 of 8
(208 Views)

A straighforward one ? I guess no (IMHO, I might be wrong)


You may provide feedback and this new feature request on TestStand Idea Exchange (check if someone didn't already ask for this kind of feature).


On the other hand, developping something specifically because JSON is the format requiered will requiere time for development, testing, maintaining this, etc. This may be an argument to go to another format, for your supervisor.


I don't have the whole picture, what is the origin of these JSON files? Who does provide them? Another (workaround ?) solution may be to extract data from your JSON files and format it into a Property Loader supported text format (or wharever you want that is supported byt the Proerty Loader. And then use build-ins features.

Message 6 of 8
(204 Views)

@Mathieu_R. wrote:

A straighforward one ? I guess no (IMHO, I might be wrong)


You may provide feedback and this new feature request on TestStand Idea Exchange (check if someone didn't already ask for this kind of feature).


Already submitted, see: Property loader JSON support - NI Community

For those that like the idea, please use the kudo star at the above linkeejallen_0-1730393230735.png

 

0 Kudos
Message 7 of 8
(140 Views)

@Liorbu wrote:

My supervisors want it to work for json files only... is there a solution? 


There is a way to save property objects to a JSON string.

See: Solved: Re: TestStand Report Results as JSON - NI Community

Please note that this converted the ResultList to JSON.  You could try other property objects.  Also, I don't see a way to convert a JSON string back to a property object.

0 Kudos
Message 8 of 8
(137 Views)