NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Pass array of containers through parameters

Hello all,

Months ago I have created a labview module which requires an array of clusters of three elements (string, string, boolean). When I created this module I didn't know that I was going to use it in a Subsequence. Actually this module is in a subsequence and I need to set the array of containers from the Sequence Call.

 

When we want to set the values directly in the step settings, there is a magic "+" which allows us to add elements to the array. But if I want to set the values through parameters there is no magic "+" to add data.

 

We have to create a FileGlobals with delimited number of elements in array, set every individual values in the pre-expression and put the FileGlobals as propertyobject in the labview module...

 

Is there a fency way to do that?

 

Thanks

Jimmy

0 Kudos
Message 1 of 4
(3,499 Views)

Hello Jimmy,

 

I don't know that I am understanding exactly what you are doing but let me offer a few suggestions and you can clarify if they are not helpful.

 

1) You can resize an array by clicking the "resize array" button next to the variable name in the variables pane.

 

2) You can add an element to the array programmatically by calling the "clone" method of the TestStand API. You could have a step(s) that do this and then loop them a number of times you input in the subsequence.

 

Mainly what I don't understand is why that you are calling the code modules in a subsequence and you were manually adding elements before but cannot manually add elements now using the subsequence. Was it always the original goal to add elements programmatically? What is the overall goal of this application? Why are you adding elements manually?

 

Thanks for the post and let me know so I can assist further.

 

With warm regards,

David D.
0 Kudos
Message 2 of 4
(3,482 Views)

Hello David,

well actually this module is the first step of the subsequence and modify some keys in a ini file. The subsequence depends directly on the values I am passing through the FileGlobal. I call often this subsequence, and the test must be simplified as a step (the SequenceCall). When I designed the module I was discovering teststand and it was fancy to add data in the step settings, well the problem appeared when I realized that I was copying this module a lot of times in sequences and it was heavy, so I had the idea to put it in a subsequence and we designed a lot of sequences using this model.

 

But I thought it was possible to retrieve the "add elements to array" button in the SequenceCall, if I create an empty array parameter into the subsequence... As if I would be directly in the step settings of the module...Well it's not that friendly, to make the subsequence useful I have to pass data by the FileGlobal in the SequenceCall pre-expression, sometimes I need to modify 3 keys, so my array has 3 elements, but my colleague needs 4 elements, and we are actually merging our sequences. When I only need one element, I have to clear the values of elements I don't need for every SequenceCall... And the usage of pre-expression is not very fancy when you wish to use it for something else, it's heavy and confusing for someone that will need to debug it later

 

I would like to know how to fill the array of the module, in the sequence call, I think the fanciest way is to use parameters, as you said, I could use an empty array as parameter, and fill it with some API commands. Do you know how to fill an array of containers by parameters? Something such [{el1,el2,el3}, {el1,el2,el3}, {el1,el2,el3}] but I tried this and it's apparently misspelled.

 

Regards,

Jimmy

0 Kudos
Message 3 of 4
(3,479 Views)

Hello Jimmy,

 

It sounds to me like the best method would be to modify the sequence to use pre-expressions based on a fileglobal "setting" where you would denote whether it was you or your coworker (therefore 3 or 4 elements). I can understand where you might want to try a different method though so you could also create two completely separate sequences and then use a precondition on a setting (similar to the previous method but easier to read/debug at a high level).

 

I would recommend passing a variable to the code module and performing options on that variable if you are going to use the API, however again at some point you will need to have a precondition/preexpression.

 

You can insert new elements into a variable with the InsertSubProperty method of the PropertyObject Class (read the help for more information on the settings) and you can delete them using the DeleteElements Method.

With warm regards,

David D.
0 Kudos
Message 4 of 4
(3,474 Views)