From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic population of the data. How to do it?

Hi,
 
It will be long story.
 
I'm working on something, which for my own usage, I temporarily named "quasi-inheritance".
 
The aim of it is to populate with different data a bunch of variables of the same custom type. This custom type in general consist of the container which consist of others built-in, custom and standard data types.
 
Of course at this stage the solution is trivial. Ordinary "=" operation will do the job. However, I do want to copy the data which are "not initialised". If the variable is "not initialised" in the instance of my custom type then inherit it from the default container. If the variable is initialised in the instance of my custom type - accept it and do not inherit respective value from the container storing common data.
 
Why I'm doing it?: My bunch of variables is the collection of the test parameter data for group of the products. The structure of the data set for every product - data type -  is the same for every product. The products belong to the same family and they are differ amongst themselves by small details in the value of the data, not in structure of the data. It'd be convenient to store the common data in one place, and make necessary, distinguish for the product modification, when the data set for particular product is instantiated, in the way described in above. Where is value added? Often, the change is common for all family, and it would be very convenient to to make the change to the test parameter in one place rather than make the change in for example twenty places.
 
So, what this "initialisation" means for me in TS in this case?
 
As far as I know in TS I cannot declare the variable without definition. In TS the defaults are empty string for string, nothing for object reference, 0 for a number and false for boolean. Only object reference and string have a "nullable" feature (value Nothing and empty string respectively) which could be used to determine is the object reference or string were filled in with something. However, I cannot do that on the number and boolean.
 
To arm the numeric data type in this "quasi-feature" of being nullable, we can do by determine does the number data type is initialised or not using simple the trick: I'd use a kind of predefined value which I did not expect to appear in real-world measurement system, for example -999. Then, before the copy operation I can compare is the data in the destination equals -999; in case of positive answer, I'd treat this property as uninitialised, ready to override.
 
For boolean this "quasi-inheritance" mechanism doesn't bring any value added; because it is two state property mechanism I'd need to edit the properties which I'd need to change from default.
 
So I could go through my bunch of variables, enumerate all of them checking and comparing the values with the values I assumed represent "not-instantiated" (not modified). At the end of the day I'd have what I wanted: a bunch of dynamically populated variables fitted for every product in the family.
 
However, this solution looks like bit complicated in comparison we could achieve in other languages. In C# the situation would look a bit different as C# supports nullable feature. So, I could declare the type - let say AAA - with NULL value. Then I could create the instance of the data type AAA with default values. Then I could create my bunch of variables by inheriting or constructing with overloaded constructors from the default instance and explicitly changing values I want to be different from. 
 
Questions:
1. Is there any other way/approach I could populate the bunch of variables in the way I've presented which could be similar - in simplicity - as I'd do it in C#?
2. Can I do it in TS in the different way I've described?
3. If yes, what TS API functions it'd be the best to use?
 
0 Kudos
Message 1 of 5
(4,853 Views)

Hi MimiKLM

 

My name is Jonathan & I work within the Applications Enginerring department at NI. Thanks for posting such an interesting question, it really got me thinking. I don;t know wheteher the best solution would be for you to incorportate C programming using LabWindows/CVI into Teststand in order to create a test sequence with easier programmable values. I have attached some information below which may be useful for your application.

 

Do you pay for any support from NI? As im sure that an Field Engineer would be happy to speak to you in regards to this.

 

I hope you find this information useful:

 

http://www.ni.com/pdf/manuals/375070a.pdf

http://www.ni.com/white-paper/14378/en/

https://decibel.ni.com/content/docs/DOC-37227

 

Cheers

 

J

0 Kudos
Message 2 of 5
(4,785 Views)

Have you looked into Property Loader?  It allows you to populate a container's data and can be used to populate only certain values. For example, you can load all the default values firstly. Then depending on specific product you are testing, you can replace specific values to customize it for your product. Thus kind of allowing it suport inheritance and nullable data.

 

Take a look here and see if this helps your problem. Help Link

Certified-LabVIEW-Architect_rgb.jpgCertified_TestStand_Architect_rgb.jpg


"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books

0 Kudos
Message 3 of 5
(4,772 Views)

Hi Jonathan,

 

Yes we have support from NI.

 

Before I speak to Field Engineer I wanted to know what other members of the forum think about that.

 

I have a good feeling that it could be achieved if in TS developers could define the .NET types. I've posted the idea of it on the NI TS idea forum: 

 

Thanks for the links to documentation.

 

bsvare, I don't want to use Property loader.

0 Kudos
Message 4 of 5
(4,739 Views)

Hi MimiKLM

 

hat seems fair. 

 

If you need any further assistance let me know 🙂 

0 Kudos
Message 5 of 5
(4,730 Views)