09-16-2021 03:42 AM
Hi, I want to use API function to add or change the Name or key of the array, e.g. I have an array of container, called DataTest
Now I want to add a Name to each element, namely
I have found the API function called SetNthSubPropertyName, which can be used
to dynamically set the Name (either in Teststand or external programming language).
However, I use the following script, it leads to error
FileGlobals.DataTest.SetNthSubPropertyName("", 0, 0, "SomeName0"),
FileGlobals.DataTest.SetNthSubPropertyName("", 1, 0, "SomeName1"),
Interestingly, I can use similar code to change the sub fields, e.g.
FileGlobals.DataTest[0].SetNthSubPropertyName("", 1, 0, "SomeAnotherFieldName1"),//change FieldName
Can anyone tell me how to set or change the Name for DataTest[i], i=0,1,2... with API function?
Thank you!
09-20-2021 05:06 AM
Until now,I wan't even aware that it is possible to assign a name to array elements....
Yet, I have to admit, I regard this kind of name assigment as problematic.
If you have the neccessity to assign individual names to the data sets, I'd strongly recommend having an according element in the container.
Also make sure to use a custom data type with proper versioning.
09-21-2021 02:46 AM
Thank you for your comments. You may know that it is quite easy to assign a Name or key to an array directly in Teststand without using API:
e.g. DataTest[0].Name = "SomeName0", DataTest[1].Name = "SomeName1", ......
The benefit to do this is for a direct and quick search some element within an Array by using the Name or key such as DataTest["SomeName0"] instead of basing on index like DataTest[0].
There should be API solution for the same with other languages as an interface. If we do not have one API function for it, then as you said, we need to consider to convert an array into Container and convert it back to array.
09-22-2021 08:46 AM
Since the SequenceEditor is based entirely on API, it is surely possible, at least in some weird way.
My point is: not every functionality that SeqEdit (and TestStand as a whole) offers makes sense in terms of clean coding 😉