NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I read a step's requirements? Step.Requirements doesn't display reqrmt.

Hi,
In TestStand, each step or sequence has a requirement property.  When one type a requirement in for a step , the requirement text will appear on the Requirements column or a step. 
 
I try to read the step's requirement by using Step.Requirements, but Step.Requirements object is PropertyObject, and it does not have a property or method to display the step requirement. 
 
Please let me know how I can access/read the step's requirements. 
My email address is anh.t.doan@boeing.com.
 
Thank you.
 
Anh Doan
0 Kudos
Message 1 of 5
(3,925 Views)
The requirements PropertyObject is an array of strings.  You can access each individual item by using the following method:

PropertyObject.GetValStringByOffset

You will need to know how many requirements there are, so you will need to know the array size.  You can use the method:

PropertyObject.GetNumElements

Allen P.
NI
0 Kudos
Message 2 of 5
(3,921 Views)
Hi Allen,
 
I follows your suggestion, but it does not work as follows:
1. On the step that I try to print out its requirement,  I have the following statement in the step's Post-Expression:
    Locals.NumElements = RunState.Step.Requirements.GetNumElements()
 
where Locals.NumElements is a local variable having type of Number.
 
I ran it and got the following error:
The post-expression for the step 'ROM Test' could not be evaluated.
Error in call to TestStand API member 'PropertyObject.GetNumElements'.
Specified value does not have the expected type. [Error Code: -17308]
 
2. I then tried the following statement in the step's Post-Expression:
    Locals.Requirement_String = RunState.Step.Requirements.GetValStringByOffset(0,0)
 
where Locals.Requirement_String is a local variable having type of String
 
I ran it and got the following error:
The post-expression for the step 'ROM Test' could not be evaluated.
Error in call to TestStand API member 'PropertyObject.GetValStringByOffset'.
Specified value does not have the expected type. [Error Code: -17308]

Please let me know how I could fix this to read the requirements.

Thank you,

Anh Doan

0 Kudos
Message 3 of 5
(3,903 Views)
Sorry for the mistake!

The Requirements are stored in a subproperty (Links) in this object.  You can use the following code instead:

Locals.NumElements = RunState.Step.Requirements.Links.GetNumElements()

and

Locals.Foo = RunState.Step.Requirements.Links.GetValStringByOffset(0, 0)

Allen P.
NI

0 Kudos
Message 4 of 5
(3,900 Views)

Allen,

Your new syntax works great!   I could read the requirements now. 

Thanks a lot! 

Have a nice weekend!

Anh Doan

0 Kudos
Message 5 of 5
(3,896 Views)