NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically create container based on values loaded from propertyloader

Hi All,

 

I want to load values from an ini file at runtime into the teststand model via a property loader.

 

I do not know the size of the data (number of strings) within the ini file until the property loader has ran, how can I programmatically create a container based on the size of data found within the property loader?

 

E.g. data within ini would be....

 

option 1, option 2, option 3......option n

 

Container created in teststand will contain 

 

options1 to option n

 

The desired result is to be able to pass a container full of strings to a teststand user interface written in labview. The data will be used to populate a combobox.

 

Thanks

 

0 Kudos
Message 1 of 5
(3,774 Views)

Does it have to be a container?  Why not use an array?  For example you could have a container of key value pairs and make an array of them.

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

No I don't suppose it does. I would be happy with an array, I just assumed both would have the same issue. 

 

Both would be of unknown size until the property loader has executed.

 

Could you elaborate on what you mean by "container of key value pairs and make an array of them"

 

Thanks

0 Kudos
Message 3 of 5
(3,707 Views)

Because you are using this information to send to the UI via UIMessages my guess is that each piece of data needs to be identified somehow.  So make a datatype with 2 elements.  One of them is the key, or identifier, that is of type string.  This way when you iterate through the array you can use the key to identify what the data is.  Not sure if this is relevant to your situation but it sounds like it might be.

 

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

AndyTT,

You can use PropertyLoader in TestStand 2016 or later to create non-existing properties.

 

Do the following to test the creation of non-existing properties:

  • Create a Property Loader File by doing the following
    • Create a new sequence file. In MainSequence, create a container named "Container" with 3 sub-properties (Number, String and Boolean) under Locals.
    • Launch Tools >> Import/Export Properties and go to export
    • Go to 'Property Selector' tab and select the container you have created under Locals.
    • Go to 'Export Options' tab. Select the type as csv and provide a valid destination location. Make sure you have enabled all the optional information (Sequence, Category and Type)
    • Click Export button to create the file.
  • Create non-existing properties in a sequence file by doing the following
    • Create a new sequence file (which will have an empty MainSequence and contains nothing else).
    • Insert 'Property Loader' step.In the row to specify the sources, select the source type as csv and specify the 'Source Location' as the path of the file you created earlier. This is an expression and hence, path can be calculated programmatically.
    • Enable "Import All Properties from Source" and set the option of "When Property Not Present in Destination" to 'Create Property'
  • Executing the MainSequence that contains the property loader step will create non-existing properties at runtime. To view the properties, set a breakpoint after property loader step. When breakpoint is hit, you can view the variables created.

 

Once you have it working, all you need to do to create non-existing properties is to modify the file with all the required properties to be created (along with its type information). Property loader step will create those properties on execution.

 

-Shashidhar

Message 5 of 5
(3,665 Views)