LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

creating arrays programmatically teststand

Hi,

I want to programmatically create an array in a TS sequencefile (local or fileglobal).

after searching the NI website, i found the Creating Arrays(TS 20) example  - it should work with TS 3.0

but when i start the seq nothing happens - it seems that no array was created

anyone got an idea / experience with this example?


regards
timo


0 Kudos
Message 1 of 6
(4,537 Views)
the local array only exist on run time!
0 Kudos
Message 2 of 6
(4,493 Views)
Hi Timo,

There are three ways to programmatically create a TestStand array. All of them require using the TestStand API to insert the array as a TestStand variable (i.e. local, parameter, fileglobal, stationglobal) or as a property (e.g. step property).
  • Cloning an Existing Array
    If you have an existing array, you can clone it and then insert a new array based on that clone. The new array will be identical to the original array (i.e. same type, size and values). You can then modify the contents of the new array if needed. Use the following TestStand API methods to accomplish this:
    a) PropertyObject.Clone
    This method creates a copy of the property that the you specify in the lookupString parameter. The return value is a PropertyObject object which you will use in the PropertyObject.SetPropertyObject method, described below, to insert your new array.

    b) PropertyObject.SetPropertyObject
    Use this method with its Options parameter set to 1 (InsertIfMissing) and pass the PropertyObject reference you got with the PropertyObject.Clone method, described above, as the newValue parameter. The name of your new array can be set in the lookupString parameter.


  • Creating a New Array Object
    This method creates a brand new array object that you can then insert as a regular array. The new array will be empty (zero elements) but you can then resize it and modify its contents as you would do with any array. Use the following TestStand API methods to accomplish this:
    a) Engine.NewPropertyObject
    This method creates and returns a new PropertyObject object which you will use in the PropertyObject.SetPropertyObject method, described below, to insert your new array. The method has the following prototype:
    Engine.NewPropertyObject (valueType, asArray, typeName, options)

    Notice that the second parameter is a Boolean flag that allows you to specify that the Property Object you just created is an array. You can specify the type of the new array in the valueType parameter.

    b) Engine.SetPropertyObject
    Use this method with its Options parameter set to 1 (InsertIfMissing) and pass the PropertyObject reference you got with the Engine.NewPropertyObject method, described above, as the newValue parameter. The name of your new array can be set in the lookupString parameter.


  • Using PropertyObject.NewSubProperty
    This TestStand API method creates a new subproperty with the name specified by the lookupstring parameter. The method has the following prototype:
    PropertyObject.NewSubProperty (lookupString, valueType, asArray, typeName, options)

    Notice that the third parameter is a Boolean flag that allows you to specify that the subproperty you are creating will be an array. You can specify the type of the new array in the valueType parameter and its name in the lookupString parameter. The new array will be empty (zero elements) but you can then resize it and modify its contents as you would do with any array.
For detailed information about these TestStand API methods, please refer to the Teststand Help that you can access by opening the TestStand Sequence Editor and choosing Help»TestStand Help. All of the TestStand API methods are available to any programming language that supports ActiveX programming. You can also refer to the related links below for an example on how to implement the methods described in this document and other related information.


Kind regards....

0 Kudos
Message 3 of 6
(4,451 Views)
Hi UM,
thank you for answering my posts:

in the Readme of the example is a text similar to your reply and I found the KB, too
(http://digital.ni.com/public.nsf/allkb/C7C81F4AE5A46BB686256CDA005FA4C6)

regards
Timo
---
0 Kudos
Message 4 of 6
(4,437 Views)
wow.
0 Kudos
Message 5 of 6
(4,431 Views)

HI UM,

 

don t take my reply seriously.

my question was about how I can create a "visible" (not temporary) local.array

 

regards Timo

 

btw: are you from NI Germany (munich)

---
0 Kudos
Message 6 of 6
(4,425 Views)