NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

read the requirments list for a sequence in a sequence file

Hi,

How can i read the requirments list for a sequence in a sequence file.

i used the below code for that but am getting "requirments" string.

 

SequenceContext seqctx = e.uiMsg.Thread.GetSequenceContext(0, outframeid);

 

if(seqctx.PreviousStepIndex >= 0)

{

Step prvstp = seqctx.PreviousStep;

String SeqTestID = prvstp.Sequence.Requirements.Name;

 

Thanks in advance

IVI

0 Kudos
Message 1 of 6
(3,560 Views)

From the TS Help:

 

"""Requirements Property (Read Only)

Syntax

Step.Requirements

Data Type

PropertyObject

Purpose

Returns the Requirements property for the step. The Links subproperty of the Requirements property is an array of string values that represents the product and unit requirements the step covers.

Remarks

You can use the following pseudo code to add a new element to the list of requirements:


PropertyObject links = step.Requirements.GetPropertyObject("Links", 0);
int nextAvailableIndex = links.GetNumElements();
links.SetValStringByOffset(nextAvailableIndex, PropertyOptions.PropOption_InsertElement, "REQ_ABC");"""

 

 

 

Instead of SetValStringByOffset use Step.Requirements.GetPropertyObject("Links",0x0).GetValStringByOffset(0,0x0).  Also, you don't have to get the nextAvailableIndex if you know which index you want.  If you want all indices then you will have to iterate.

 

Hope this helps

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 6
(3,556 Views)

The Name property of the Requirements property is returning "Requirements" because that is indeed the Name of the property. Requirements is actually a container, which holds a sub-property Links. Links, in turn, is an array, which you can then index each requirement out of.

 

If you know you'll always have just one requirement, calling Str(Sequence.Requirements.Links) will give you the requirement, but if there's more than one, all the requirements will be concatenated without a delimiter. 

 

Edit: Ahh, jigg beat me to the punch.

Message 3 of 6
(3,554 Views)

Hi,

Can you please explin in bit detail.

am got confused with the explanation.

 

 

Thanks

Bharathi

0 Kudos
Message 4 of 6
(3,549 Views)

Once you have a handle to the step:  In your case prvstep.  One of the subproperties of a step is the Requirements.  Well Requirements is also a Property Object.  In TestStand a Property Object has methods and properties associated with it.  I assume you understand that since you are using an object oriented programming language.  One of the properties of Requirements is an array of strings called Links (as pointed out by the TS help).  So you need to get access to that array and index the element in there you want.  The reason they are called Links (I'm assuming) is because they "link" to a requirement.

 

Edit: Since a lot of objects inherit from the Property Object then you can use the methods and properties to access parts of an object in TestStand.  One of the methods of a Property Object is the GetValStringByOffset.  You can also read about that in the TS help but basically it is used to index an array of strings and return an element.

 

Hope this helps!

 

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 5 of 6
(3,539 Views)

Thanks this helps.

0 Kudos
Message 6 of 6
(3,528 Views)