12-03-2020 07:55 AM
Hello,
I would like to include a string value into the "name" of a step parameter but I didn't found how to do this.
To be clear, I have a container with 5 strings ("A","B","C","D","E", for exemple) and I have locals.Results.A, locals.Results.B, etc.
I'm doing a foreach on my container and I want to save the result of my calulation in the good locals.Results but I don't know how to "use" my strings values to complete the value that i have to set for the parameter name of my sub sequence (I tried locals.Results.(container.string1) but it does not functionning)
Unfortunaly, I can't send a screen shot of my work, but if it's needed, I'll create a "false sequence".
I hope i have been clear.
Sincerely,
Jonathan
Solved! Go to Solution.
12-03-2020 10:17 AM
In Pre-Expression or Post-Expression, you could add "Step.Name=" and after that add an expression that includes your desired string.
12-04-2020 01:35 AM
First of all, thank you for answering me.
But I think that it's not what I need.
Indeed, I could effectively rename my step dynamically, but it won't change the name of my subsequence parameter.
In the exemple attached to this message, I show what I want to do (obviously, my sequence have much more parameters).
The goal is to set the parameter_OUT as : "Locals.Results." + the value of the current element. So when the current element is "a", I set the Parameter_OUT as : "Locals.Results.a"
I hope it's clearer.
Thanks a lot,
Sincerely,
Jonathan
12-04-2020 08:28 AM - edited 12-04-2020 08:33 AM
I think that I found a solution.
It seems that we can use the GetValString function to perform this.
Locals.Results.GetValString(mycurrentstring;0)
I'll try it on next tuesday on report it here if it's functionning
12-07-2020 02:03 AM
In fact, this method is functionnning only for passing parameters by value, but I need to pass them by reference, so, it is not the solution.
12-07-2020 06:31 AM
Here is a solution to conturn the problem.
In a foreach (Locals.ActualTest in Locals.Test) loop
Locals.Test is a string array in my exemple
- Save the results in a locals.Numeric1
- Then save the result in the good Locals.Results.TestX by using the SetValNumber method in a statement :
==> Runstate.Main.Locals.SetValNumber("Results."+locals.ActualTest;0x1;locals.Variable)
It will create the variable and register the value inside.
Thanks to all who has worked on my issue.
I let this topic openned for the week in the case of somebody has a better solution.
Jonathan
12-16-2020 07:19 AM
I found an other solution.
We can use the "Evaluate" function to do this.
Here's an exemple :
Evaluate("Results."+locals.ActualTest)
Teststand warn me about a "syntax error" when I use this but it is functionning.
Sincerely,
Jonathan