06-25-2010 08:20 AM
I am attempting to access (read and write) attributes of the following:
SequenceFile
Sequence
Sequence Steps
When looking at the TestStand API documentation, the following functions are available:
PropertyObject
Properties
Methods
I attempted to use SetValString and GetValString commands using the Attributes reference, but it does not seem the data is stored within the file.
I cannot find the following information within the TestStand API:
Any advice or information is appreciated!
Solved! Go to Solution.
06-28-2010 05:15 PM
Hi LVB,
You should be able to access your custom attributes for each sequence file, sequence, or step by following the Attributes reference with your custom attribute name.
For example, Step.AsPropertyObject.Attributes.<attributename> should let you then read or set a particular value. I hope this helps!
06-29-2010 11:52 AM
Swathi,
Thank you for the response. I am currently usting the method you suggested. Upon further investigation, it appears that I can access the attributes. However, the attributes are not saved wehn I call the SequenceFile.Save command.
What is the suggested method to make attributes persistant and store within the Sequence File?
Thanks!
06-29-2010 02:00 PM
You are likely changing the run-time copy of the sequence rather than the edit-time copy.
06-29-2010 03:08 PM - edited 06-29-2010 03:12 PM
After some further testing, this only occurs when writing attributes to the SequenceFile object. The Sequence and Step property object values are stored upon the SequenceFile.Save command.
The fact I cannot find a way to access this through the TestStand Sequence Editor makes me curious. However, the help file says that all PropertyObjects should support attributes.
From the TestStand 4.2 New Features Help:
PropertyObject Attribute Support
You can now create attributes for TestStand PropertyObjects, such as variables, steps, and module parameters. Use attributes to store additional information, such as the author of a sequence, about a PropertyObject within a sequence file or type palette file.
When you copy a PropertyObject, TestStand adds the attributes stored on the PropertyObject to the new copy. You can create attributes for properties of a type. Attributes of type properties specify the default attributes when you create an instance of a type.
Every PropertyObject includes an Attributes property, which is an unstructured container that stores arbitrary data. Although an attribute can be any kind of data, you typically create a name-value pair to give an attribute a name and a data value.
Right-click a PropertyObject on the Variables pane and select Advanced»Edit Attributes from the context menu to launch the Attributes dialog box, in which you can create and edit attributes. PropertyObjects with attributes include an Edit Attributes button in the Name column of the Variables pane.
Steps with attributes include the word Attributes in the step description, and the General panel of the Properties tab on the Step Settings pane includes an Edit Attributes button.
06-29-2010 05:09 PM
You need to increment the change count of the file after editing it or the sequence editor (or UI) won't know to refresh or mark the file as modified. Use sequenceFile.AsPropertyObjectFile().IncChangeCount().
SequenceFile attributes are stored on the SequenceFile.Data object, not the SequenceFile object. You can edit them on the advanced tab of the sequence file properties dialog.
Hope this helps,
-Doug
06-30-2010 11:57 AM
Thank you Doug!
I have attached my working code.
Is there any documentation that explains the structure of the SequenceFile object? How did you know the Data object contained the attribute information?
06-30-2010 09:24 PM
I'm not sure if it's documented anywhere (I'll pass along the feedback that it probably should be), but if you set some attributes on a sequence file in the sequence editor using the Sequence File Properties dialog box, then expand the SequenceFile property in the variables view, you will see an attributes button next to the Data subproperty which indicates that it has attributes. If you click on the button you will see and be able to edit the attributes you added with the Sequence File Properties dialog box.
Hope this helps,
-Doug
07-01-2010 12:46 AM - edited 07-01-2010 12:46 AM
It's all on the web..
TestStand Help 4.2 can be found at
http://zone.ni.com/reference/en-XX/help/370052H-01/
07-01-2010 07:46 AM
Roy, sing your link, I was able to locate this documentation in the NI TestStand help file under:
NI TestStand Supplemental Reference Help --> Sequence Context --> RunState Subproperties --> SequenceFile Object Subproperties
Doug, I still think this should be mentioned under the NI TestStand API Reference Help. Possibly under new SubProperties category or a See Also in the SequenceFile object description along with a more verbose description of where the data exists within the object.
Thanks for the help everyone!