NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Write default value Programatically, in a numeric elemet belonging to an array of container

hallo,

I have an Array of container Cmix. Cmix has many elements one of then is numeric element  "n"

I need to initialise only this element "n" with a default value. I want t avoid using  for ..loop.

can the same be acheived with some Array funtion or property object..  like setelements()...

0 Kudos
Message 1 of 4
(2,667 Views)

Hi,

 

Take a look at this topic:  http://forums.ni.com/t5/NI-TestStand/Loop-in-a-Pre-Expression/m-p/839137

 

I quite like Eric Crank's use of recursive evaluations as a solution.

 

Regards,

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

0 Kudos
Message 2 of 4
(2,662 Views)

thanks Charlie,

yes its doable,  although  quite some code and encapsulated in a statement  which is less readable. Ithought Testand provides

some  funtion to solve the issue.

all in all a good workaround...

 

regards,

thanks

 

 

0 Kudos
Message 3 of 4
(2,618 Views)

There is a SetElements function but it depends which TestStand version you are using

 

SetElements(Array array, PropertyObject value, [String range])
This function assigns the passed value to all indices of the passed array.  If an index range is specified, only elements in the range are assigned the passed value.
Parameter 1: An array to which the value should be assigned.
Parameter 2: The value which is to be assigned to the specified parts of the array.
Parameter 3: An optional parameter specifying the range string specifying the indices of the array to which the value should be assigned.  For example, the range "[0..2]" specifies elements [0], [1], and [2].  If unspecified, the range is assumed to be the whole array.  Refer to the "Brackets" section in the Expression Operators help topic for more information on specifying an index range.
Returns: This function always returns 0.

 

regards

Ray

0 Kudos
Message 4 of 4
(2,602 Views)