NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Log attribute into report

Solved!
Go to solution

Hello,

 

> I work with a "multiple numeric limit" test.

> For each item of my "measurement" array, I have created an attribute : a string which name is "Channel".

> Please see screenshot : you will see that during execution, I change my attribute value : in the screenshot, for "measurement[2]" you can see that "Channel = ai30"...that's exactly what I want !

> But, my problem is for logging my attribute value in the report...in the screenshot you can see that the "Include In Report" flag is set to true for my "Channel" attribute. Moreover, the report option parameter "Include In report" is also set to true. In my report, "Channel" attribute is included (as expected) BUT the value is not correct (this is the default value : an empty string 😞 ).

 

So my question is : why is my attribute value not logged into the report ? Smiley Tongue

 

Thank you in advance for your help !

 

J.

0 Kudos
Message 1 of 4
(3,806 Views)
Solution
Accepted by topic author Julien_31

I have found the problem !

 

When I tried to set the attribute value, I used an unsuitable object which was :

RunState.Sequence.Main["Calcul des valeurs des courants"].Result.Measurement[RunState.LoopIndex].Attributes.Channel = Locals.Channel_names[RunState.LoopIndex]

That was stupid because I set "a posteriori" the value of an object which was not about to be used for generating reports.

 

Instead I should have used the following object in order to set the value in the "result list" local variable (which is used for generating report) :

Locals.ResultList[1].Measurement[RunState.LoopIndex].Attributes.Channel = Locals.Channel_names[RunState.LoopIndex]

 

I'm a beginner with TS, so please let me know if my explanation is not correct.

 

J.

 

0 Kudos
Message 2 of 4
(3,774 Views)

My technique is not very clean...NI suggestions here :

http://www.ni.com/white-paper/8289/en/

 

0 Kudos
Message 3 of 4
(3,767 Views)

As a conclusion of my monologue Smiley Very Happy, here is my solution to work with attributes without modifying "result list" local variable...

> I configure dynamically "multiple numeric limit" test before it executes (by using an "expression" step).

> Note : a for loop is used in this step.

 

// Add item to "measurement" array

RunState.Sequence.Main["Calcul des valeurs des courants"].Result.Measurement.InsertElements(RunState.LoopIndex ,1,0),

 

// Configure each item of "measurement" array

RunState.Sequence.Main["Calcul des valeurs des courants"].Result.Measurement[RunState.LoopIndex].Comp ="GELE",

etc ...

 

// Add attribute for each item of "measurement" array

RunState.Sequence.Main["Calcul des valeurs des courants"].Result.Measurement[RunState.LoopIndex].Attributes.NewSubProperty("Channel", PropValType_String,False,"",0),

RunState.Sequence.Main["Calcul des valeurs des courants"].Result.Measurement[RunState.LoopIndex].Attributes.Channel.SetFlags("",0, PropFlags_IncludeInReport),

RunState.Sequence.Main["Calcul des valeurs des courants"].Result.Measurement[RunState.LoopIndex].Attributes.Channel = Locals.Channel_names[RunState.LoopIndex]

0 Kudos
Message 4 of 4
(3,758 Views)