09-03-2026 07:27 AM
Hello,
currently i have this statement to set all values in an array:
SetElements(StationGlobals.Project.Serial.Response_Array, "-999")
Now i need to replace the ..Serial.. with Serial0, Serial1, Serial2 where the numeric value is the ThisContext.RunState.TestSockets.MyIndex
How can i define the StationGlobal to use the addidtional MyIndex for the correct container?
Thanks
Solved! Go to Solution.
09-03-2026 07:35 AM - edited 09-03-2026 07:41 AM
You mean, you want each socket execution to create theri respective element in the StationGlobals?
StationGlobals.Project.Serial0
StationGlobals.Project.Serial1
.
.
.
?
09-03-2026 07:39 AM
Yes, i have four containers and in each of them an array should be set to -999
09-03-2026 07:54 AM
//Create the Serialx Container
StationGlobals.NewSubProperty("Project.Serial"+ Str(RunState.TestSockets.MyIndex),PropValType_Container, False,"", PropOption_SetOnlyIfDoesNotExist),
//Create the Array
StationGlobals.NewSubProperty("Project.Serial"+Str(RunState.TestSockets.MyIndex)+".Response_Array",PropValType_String, True,"", PropOption_SetOnlyIfDoesNotExist),
09-03-2026 07:59 AM
The four containers and the arrays already exist i only want to set the array values to -999
09-07-2026 06:52 AM
Hello,
in a statement i want to do this (what is not running):
SetElements(StationGlobals.Project.Serial" + Str(ThisContext.RunState.TestSockets.MyIndex) + ".Response_Array, "-999")
When executing a 4x batchmodel it should set all values in the four arrays to -999.
The four StationGlobal arrays already exist
StationGlobals.Project.Serial0.Response_Array
StationGlobals.Project.Serial1.Response_Array
StationGlobals.Project.Serial2.Response_Array
StationGlobals.Project.Serial3.Response_Array
Thanks
@Olil_Wachno, in your reply i can only see four lines in the code, are there more lines hidden after the comma?
09-07-2026 07:52 AM
@OnlyOne wrote:
Hello,
in a statement i want to do this (what is not running):SetElements(StationGlobals.Project.Serial" + Str(ThisContext.RunState.TestSockets.MyIndex) + ".Response_Array, "-999")
OK, this one took me a bit at first 🙂
If you look at the description
the first argument of function is an Array. You gave it a string.
To get the Array which the from the String is referring to, you can use the Evaluate() function like so
@OnlyOne wrote:
Thanks
@Olil_Wachno, in your reply i can only see four lines in the code, are there more lines hidden after the comma?
Only those four lines, I misunderstood your question thinking you were asking on how to create the data structure programmatically.