03-02-2006 12:04 PM
SetNumElements( Locals.Array_Name,100 )
03-02-2006 12:40 PM
03-03-2006 03:07 AM
03-03-2006 08:55 AM
03-03-2006 09:02 AM
Hi Jim,
unfortunately I don't think you're going to acheive this as a statement.
The evaluate returns the item from the string, but since it translates to a string, that's what's being returned - the string, no the property object.
So you could do an activeX call on the TestStand API for a propertyobject from thiscontext as the object, and then a method SetValString.
The lookupString would then be
Evaluate("\"Locals.\"+ Locals.Name + \"[0]\" ")
that should handle it for you. (you could do this as a pre-expression if necessary and tack it into a local data space for convenience. The string is kind of complex, because you need the \"s to get the actual literal string that evaluate is using to translate to "Locals." + Locals.Name + "[0]"
Until there's a operator/function that converts a string to an object reference, then we'll have to stick with the ActiveX method.
Sorry.
Thanks
Sacha Emery
National Instruments (UK)
03-06-2006 06:06 AM
Hi Sasha
The real situation that I am working on is as follows which is a bit more complex:
The arrays that I am manipulating are arrays of containers similar to the locals.ResultList but they are stored in StationGlobals.Test_Cases
I can create the arrays and resize them now.
The local.Array_Name variable holds the value "StationGlobals.Test_Cases.Array_A" where Array_A is the array that I created and resized.
the Local.X holds the current array index that I want to write data to
How complicated is it to add a single result cluster to a given element? can I do this in one step?
Again thanks to everyone for the assistance.
Jimmy
03-07-2006 03:23 AM
Hi Jim,
you'll need the correct property object to start with, i.e. the container that you want to put in place and then you can use SetValVariant from the property object.
The other option is to do it one field at a time, and adjust the lookup string appropriately.
I've attached an example using set val variant in TestStand 3.5 (I've just kept it all Local, but it should be quite easy to translate to your StationGlobals.)
Hope that helps
Thanks
Sacha Emery
National Instruments (UK)
03-09-2006 05:47 AM
Hi Sasha
That's exactly what I want to do. Thanks a million
Jimmy
03-23-2006 08:51 AM
Following on from what I have learnt so far I now have the following problem.
I want to create an array of user defined containers. i.e. each element would be a cluster containing strings, numbers or anything else.
For this example I will call it MyContainerType.
I have tried to create an array of containers but when I try to add an element of MyContainerType I get an error message as follows
An error occurred calling 'SetValVariant' in 'PropertyObject' of 'NI TestStand API 3.1'
Variable or property types do not match or are not compatible.
Error accessing item 'StationGlobals.Test_Cases.My_test_step_100[0]'.
I am using the function NewSubProperty to create the empty array and setting the property value type to PropValType_Container
is there a better way to create an array of a user defined type?
Regards
Jimmy
03-27-2006 05:52 AM - edited 03-27-2006 05:52 AM
Hi Jim,
hopefully this posting will give you the answers you need.
http://forums.ni.com/ni/board/message?board.id=330&message.id=10088#M10088
essentially I think you need SetPropertyObject, and not SetValVariant.
Hope that helps
Sacha Emery
National Instruments (UK)
Message Edited by SachaE on 03-27-2006 11:53 AM