NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the ReportText?

Hi

I want to change the ReportText of a PASS/FAIL or Numeric Measurement! If the step FAIL I want i the Report the ReportText= "Battery current is to high" and if the Step PASS ReportText="Battery current OK". I don't know how to do this I searched the forum and the TestStand help! I hope someone can help my!
0 Kudos
Message 1 of 2
(3,104 Views)

Hi,

Trouble is you cannot use the Post Expression of the Step to modify ReportText because you dont know whether the step has passed or failed at this moment in time. You dont really what to added an extra step to modify the Previous Step.

What you could do, is  use the SequenceFilePostResultListEntry sequence callback. When this sequence is called you will know the Step.Result.Status and therefore you can modify the contents of the Step.Result.ReportText as required. Trouble is this sequence will affect all steps, so unless you are using custom step types which have properties containing the pass or failed string. You will have to find some other way of getting the ReportText string into the sequence.

One possible way :-

If you pass the required text for both pass and failed text from your code module

eg Step.Result.ReportText = "Battery current OK|Battery current is to high"

In the SequenceFilePostResultListEntry sequence, the Step and Result properties for a Step are passed via the Parameters of SequenceFilePostResultListEntry.

ie In SequenceFilePostResultListEntry, Parameters.Step.Result.ReportText will equal "Battery current OK|Battery current is to high" and so will Parameters.Result.ReportText.

Therefore you can now change Parameters.Step.Result.ReportText and Parameters.Result.ReportText by stripping off the required text depending on the status of Parameters.Step.Result.Status or Parameters.Result.Status

eg

(Parameters.Result.Status == "Passed")
?
(Parameters.Result.ReportText = Left(Parameters.Result.ReportText, Find(Parameters.Result.ReportText, "|" ) ) )
:
(Parameters.Result.ReportText =Right(Parameters.Result.ReportText, Len(Parameters.Result.ReportText) - Find(Parameters.Result.ReportText, "|" )  - 1))

Then

Parameters.Step.Result.ReportText = Parameters.Result.ReportText

 

So the First part of the expression strips out either "Battery current OK" or "Battery current is to high" depending on whether Parameters.Result.Status is "Passed" and puts the value back into Parameters.Result.ReportText. When SequenceFilePostResultListEntry returns Parameters.Result is put into Locals.ResultList but the value of ReportText in the Step still contains the original string. Hence the final part of the expression above. This updated the Step.Result and therefore will contain the modified version.

Hope this is clear.

Regards

Ray Farmer

 

 

Regards
Ray Farmer
0 Kudos
Message 2 of 2
(3,088 Views)