08-24-2011 04:48 AM
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
08-24-2011 08:39 AM
From the TS Help:
Step.Requirements
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.
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
08-24-2011 08:45 AM - edited 08-24-2011 08:46 AM
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.
08-24-2011 09:44 AM
Hi,
Can you please explin in bit detail.
am got confused with the explanation.
Thanks
Bharathi
08-24-2011 10:29 AM - edited 08-24-2011 10:32 AM
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!
08-24-2011 10:32 PM
Thanks this helps.