NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Call a subsequence with parameter of type container, keeping some its fields default values

Hello,

I think it is not possible, but:

I call sub-sequences having a parameter of container type, whose most of the default values defined for fileds fit my use. I wish to change the value of only one field of this container parameter.

The first solution is building a Local container of the same type, set all the fields to their default value (in the subsequence) and set the single one I want to customize with my own value; but I need to know all those default values, what I can do by opening the subsequneces (but I omitted to say I have a lot of subsequences with this same parameter of container type, so it is a lot of work to do!).

The ideal solution would be to have some way for programmatically getting the subsequence parameter default values, then set all in my Local container, and change the only one I'm concerned about.

I don't know how doing, and I'm counting on you!

0 Kudos
Message 1 of 6
(3,346 Views)

Do your subsequences use different default values of the field? I understand, that you need to change some of them based on subsequence, but in general, are fields' values default values are the same for different subsequences?

Then, you call these subsequence from somewhere - let's say, directly from MainSequence callback. So you can assign in the beginning default values for this container, what you are going to pass inside (I'm not talking about parameter container, what is used inside of subsequence).

And after it, you need to change just those parameters, what are not default, e.g. you don't need all the time to assign default values to container, but you need just to rewrite values of non-default fields.

And this you can do directly inside of the subsequence.Update non default values.png

Hopefully, screenshot will help...

But, if your default values for different subsequences are different, then you need all the time to rewrite them - b/c in this case they are not default; they are custom, modified.

Also, in this case be aware to setup pass type "by value", not "be reference" - in order not to modify values by any chance to other subsequence calls.

 

logos_middle.jpg

 

0 Kudos
Message 2 of 6
(3,318 Views)

Thank you kosist90,

But actually all my subsequences have different default values for each field of the container. And I'd like to know those default values from the MainSequence, before calling them. I could of course open each subsequence for SeqEdit and see their values, but I want to save time by doing it programmatically, and also not being impacted by possible changes of those default values, which I do not control because those subsequences are like a toolbox maintained and used by several persons.

 

0 Kudos
Message 3 of 6
(3,306 Views)

Hello jjd,

could you then show screenshot, of how you:
- pass data inside subsequences;
- define default values for that parameters?
Because I'm curious, where actually those default values are setup. B/c one topic is to setup them during run-time before entering subsequence; and another question is how to find those values before executing of subsequence. I guess that it's possible, but quite tricky.
This is my concern - if default values are setup already; why do we need to know them before calling of subsequence? If you want to modify input parameters from MainSequence, then you can do it in pre-expression...
Please, show some more code, b/c it's still not very clear for me...

logos_middle.jpg

0 Kudos
Message 4 of 6
(3,300 Views)

Hello kosist90,

We have run into another solution.

We will refound our toolbox to split the current container into independant parameters, so users can check most of parameters to "Default" in the subsequence call, and only set a value to the one parameter they wish to customize.

That will require some effort, but easier for our toolbox users.

Anyway, thanks for your answers!

Message 5 of 6
(3,297 Views)

@jjd wrote:

Thank you kosist90,

But actually all my subsequences have different default values for each field of the container.

 


 As per my understanding, it means that if you have fields, let's say, "Num1" and "Num2", and subsequences "Seq_1", "Seq_2", then default values will be different like this:

Seq_1: Num1 = 0 (default); Num2 = 1 (default)

Seq_2: Num1 = 2 (default); Num2 = 5 (default)

But when you setup input parameter to subsequence as "Default" (with that checkbox, what you mention), it'll setup default value for variable. Means - that it'll be the same default value accross subsequences.

Then it means, that your subsequences does not have "default" values different - because there can be just one default value per variable. If values are different, then they are not default, they are custom 😃

This is what confused me...

But, anyway, if it's working for you, then it's fine 😃

But, on the other hand, it'll take the same amount of time to change container type, add additional parameters to subsequences, and to rewrite input parameters, as to rewrite values inside of subsequences directly. The only benefit what I see in your approach - is that it is more "visible" from higher level, what value is used; and this is good for TestStand implementations...

 

logos_middle.jpg

0 Kudos
Message 6 of 6
(3,291 Views)