NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Load properties into a subsequence using 2016 property loader

Solved!
Go to solution

Hi all,

I am looking to load properties into a subsequence that is called multiple times. I would like to load *different* parameters into each instance of the subsequence. I have attached how I would do this using the previous version of the Property Loader--I pass a parameter to each subsequence call to tell it what its section of the property file it should reference, then use the Start and End tokens to identify individual sections. 

My question is, how can I do something similar using the new 2016 property loader? I know I can still use the legacy property loader, but going forward I would like to have a strategy that works with the new property loader that natively supports import/export from the GUI. 

Thanks,

jppb

0 Kudos
Message 1 of 8
(5,403 Views)
Solution
Accepted by topic author jppb

jppb,

 

I have used TestStand 2016 SP1 to demonstrate how can we use new property loader to achieve the functionality you required.
I have attached the example that does the same. The followins are the steps I did to create the example:

Step 1:
Use Import/Export Properties tool to create property loader file that contains multiple property groups.
Each group will corresponds to a section in the property loader file you had attached.

Step 2:
In the new property loader step, configure the source path. I disabled "Import all properties from source"
In the property selector (present in last tab of step settings pane) where we configure what properties to import, I clicked on property selector dialog.
In the property selector dialog, I used "Load source prototype" to select all the group and properties present in the property loader file.
For each property group, I updated precondition to use the group based on the parameter value passed to the sequence. This will ensure that on each run, you load only the properties from the specified group.

Note: Preconditions for property group was introduced in TestStand 2016 SP1. Hence, this solution might not work with TestStand 2016 (without SP1).

 

-Shashidhar

Message 2 of 8
(5,377 Views)

Great solution Shashidhar, thank you.

 

Using your solution I can even preview the imported properties at edit time if I type in what parameter value will be passed to the sequence at run-time. 

 

It took me a little bit to find the new dialogs of the property loader that you were referring to in your solution. For anyone else who might have a hard time finding this, the buttons for "Load source prototype" and the "Property Selector Dialog" are circled in red below:image.png

 

Thanks again,

jppb

 

 

 

0 Kudos
Message 3 of 8
(5,364 Views)

Hi,

 

where can I find the id for echt step or sequence? You have in your PropertyFile.txt file the id='7803c5ab-34b4-411e-b2a2-96ed9b258764'. Why do you know this is exactly this ID?

 

Thanks.

Andreas

0 Kudos
Message 4 of 8
(5,054 Views)

Hi Andreas,

As far as I know that ID is generated by the property exporter when you click export (Step 1 of Shashidhar's answer above), no human wrote that ID in the property file. In fact, I never even looked at that ID, and I don't need to in order for the property loader to work because in this example we are importing properties based on name, not ID.

Best,

jppb

0 Kudos
Message 5 of 8
(5,045 Views)

But if you use the "Groups" to handle the subsequences how would you do it if you want a separate set of limits for a different Model? consider you're using a DB.

0 Kudos
Message 6 of 8
(3,643 Views)

JZam,

 

I can think of following ways to handle it:

Option 1:

Update the group name to include both the name of the subsequence and the model. You can update the precondition of the property group, in property selector dialog, as necessary so that it considers both subsequence and model.

 

Option 2:

Use different file or database (in case of DB), for different model. 'Source Location' is a TestStand expression, which you can use to dynamically provide the location of property loader source.

If you have multiple source (probably one which common for all model and rest per specific model), you can use the same property loader step and insert multiple source.

 

-Shashidhar

0 Kudos
Message 7 of 8
(3,630 Views)

Hi Shashidhar,

 

Thanks for your replay, here are my thoughts:

 

Option 1:

This could get a little bit messy if we have a lot of models and tests like this.

 

Option 2:

If we're using files it makes sense having one for each model but in case of the database you normally want everything in that same database, I don't like the idea of having 1 DB for each model.

 

I found a workaround(Check Code) to this problem, but I don't really like what I'm doing... Practically I changing the name of the sequence at runtime, in this way I don't need to use groups to handle the sequences.

Download All
0 Kudos
Message 8 of 8
(3,616 Views)