NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Array of different Custom Data Types

Solved!
Go to solution

Hi,

 

Could you help please on how to create an array of different Custom Data Types?

 

I have created already 2 different Custom Data Types in TestStand.

JoseEliasRobles_0-1618868338994.png

 

 

Now I need to create an array of different Custom Data Types, so for exaple:

MyArrayOfDifferentDatatypes[0][0] = MyPoint1

MyArrayOfDifferentDatatypes[1][0] = MyPoint1

MyArrayOfDifferentDatatypes[0[1] = MyPoint2

MyArrayOfDifferentDatatypes[1[1] = MyPoint2

JoseEliasRobles_1-1618868507302.png

 

The thing why I need to create something like this is because I have a big #DEFINE list in C that I'm trying to simulate in TestStand using Custom Data Types. I need to use these "DEFINES" over all the Sequence so I if for any reason any DEFINE value changes I will have only to modify the Custom Data Types so changes will be reflected over all the Sequence.

 

Or of you know a way on how to simulate a C DEFINE list in TestStand let me know.

 

I'm using TestStand 2016 SP1

 

Thanks for the help.

 

 

 

0 Kudos
Message 1 of 4
(1,239 Views)
Solution
Accepted by topic author elirofu1

I'm not exactly sure what you mean by simulate C define, but I've attached a sequence that illustrates different ways to make a single array that contains different custom data types.

Message 2 of 4
(1,180 Views)

@James,

 

Thanks for your reply!

 

I have a code in C that I'm trying to port into teststand, the current code I have have several functions that uses several of the already defined values in the .h file in the C project.

 

example:

 

#define POINT1 "12345"

...

...

#define POINT300 "54565"

 

I need to use these #define values in all my C code functions and since I will call these functions from testand I would need to pass these values to the C function, but since teststand do not know the value of the actual #define I need to pass the #define value "12345" instead the #define (POINT1) itself, also I have decided to use CustomDataType to stay away from global variables in testand. 

 

Thanks for your help. the sequence worked.

 

PS if you have a better way to do this please share it.

0 Kudos
Message 3 of 4
(1,177 Views)

TestStand definitely doesn't have C-like macros or header files.

 

If you were strictly using numeric values instead of strings, defining an enumeration type might be an option.

 

Instead of creating a datatype per constant, you could instead provide multiple constants with a single datatype by making a type based on Container, maybe call it MyPoints, and adding sub-fields in the container type for each constant, such as Point1 and Point2.  You will still need to instantiate a variable of that type somewhere to be able to reference your 'constants', but you only have to add a single variable of that type to make all its fields available to expressions in your sequence.

 

In the type editor, you could go to Properties>>Advanced>>Flags>>Type Flags>>Instance Default Flags and checkmark PropFlags_NotEditable on each field to make the fields seem a little more 'constant', but they will still be possible to assign to programmatically.

 

 

 

 

 

 

0 Kudos
Message 4 of 4
(1,148 Views)