This question has kind-of been asked before, but I can't find a good answer. I have a configuration file that has, say, two arrays in it. I want to load in all the elements from one of the arrays (I don't know how big the array will be, so let's assume that the local the elements are going in to is big enough for all the elements in the file) - how do I define that in a property loader? I know I can list out all the elements separately (eg: arrayOfStrings, arrayOfStrings ... arrayOfStrings[n]), but as I said, I have no idea on how many elements there will be.
I've attached an example - the config file has two arrays in it (arrayOfStrings and arrayOfNumbers). I'd like the first property loader to load in only the arrayOfStrings elements. (The second property loader loads in all the elements, just to make sure that my file is okay 🙂 )
I know that there are methods using XML and XLS, but I need this to work with tab-delimited files (it's what my client is used to, and moving away from them isn't an option right now).
Since it will successfully import all values from a given
file, what is your use case for not wanting certain values? If you are trying
to import separate data sets, i would recommend separate files. Otherwise there
is a goodbit of data missing from the .dat file included in your zip file. I
tried this again after using TestStand to export values to a .txt tab delimited
file and it works correctly.
Snowman 6008 wrote:
what is your use case for not wanting certain values? If you are trying
to import separate data sets, i would recommend separate files.
It's a pretty long story to describe the use case - just trust me: I need the properties to be in one file, I need the file to be in tab-delimted format, and I need the property loader to load properties selectively.
Snowman 6008 wrote:
is a goodbit of data missing from the .dat file included in your zip file.
Like what? I know that the XML format works, but, as I already said, I need to use the tab-delimited format. What I'm asking is if it's possible to include the information about array sizes that exists in the XML format in the tab-delimited format? If so, how? If not, then mark it as a feature suggestion, as a lot of people have asked for this funcitonality in the forums.
The reason your text file seems to work is because locals.arrayOfStrings can be addressed directly, and written to. So when you are using property loader to import all your values, TestStand will gladly write to locals.arrayOfStrings. But when you only tell it to import locals.arrayOfStrings it will evaluate locals.arrayOfStrings == locals.arrayOfStrings to be false.
This is why the "XML" version works, because the left most value is still arrayOfString.
Feel free to make a product suggestion at http://digital.ni.com/applications/psc.nsf/default?OpenForm&temp1=&node= . If you like you can also modify the property loader using the TSDBComponents.cws in C:\Program Files\National Instruments\TestStand 4.2\Components\StepTypes\Database .
As you probably already know, you can import an array property with the property loader step using the XML string format. When you import the XML string, your array property dimensions will be overwritten with the dimensions specified in the XML string. According to your post you can not use this solution and you are looking for an alternative way for importing all the individual array elements specified in your source file. Unfortunately currently there is no way for the property loader step to accomplish this because the property loader step only imports the properties specified in the selected properties list that is configured at edit time.I have reported this suggestion to the development team.
As an alternative you can accomplish what you want by using two property loader steps and the TestStand API as showed the attached example.
In the example I am trying to import the element for Locals.MyArray. In order to specify the desired dimensions of the array I am importing Locals.LowerBound and Locals.UpperBound first from the source file. Once I have the dimensions, I use them to update the dimensions of Locals.MyArray and to specify what properties should be imported by the "Import Array Elements" step.
Finally the "Import Array Elements" step imports all the array elements specified in the source file.Notice that you can easily specify the array dimensions and the array elements to import by modifying your source file. Let me know if it helps.
The sequence file was saved using TestStand 4.0 format.
I have updated failing step "Set number of elements to import in array property" with
Locals.MyArray.SetDimensions("", 0, "["+Str(Locals.LowerBound)+"]","["+Str(Locals.UpperBound)+"]")
and it now works in TestStand 4.0.