NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Include runtime info in report file path

Solved!
Go to solution

I have a test sequence that determines information about the UUT as one of the test steps, resulting in either F, P, or M; and I want the report filename to include this, for example "F_<UUT>_<UUTStatus><FileExtension>" or "P_<UUT>_<UUTStatus><FileExtension>" or "M_<UUT>_<UUTStatus><FileExtension>".

 

The information is stored in a string variable under FileGlobals.Mode. I tried using the the file path template

 

FileGlobals.Mode + "_<UUT>_<UUTStatus><FileExtension>"

 

... but i get an error at runtime that FileGlobals.Mode is unknown. I tried also using the ReportOptions callback instead of the report options dialog box, but it has the same problem. It appears that all of this information is processed before the FileGlobal variables are assigned. Yet, <UUTStatus> is obviously factored in at the end of the test execution, so this must be possible. 

 

How do I insert runtime information into the report file path? Peferrably in the template format that retains tags, such as <UUTStatus>?

 

Thanks.

0 Kudos
Message 1 of 7
(4,876 Views)

Hi,

 

I was able to change the name using the ReportOptions callback with the following statement: "Parameters.ReportOptions.BaseName = FileGlobals.Mode" If you are simply trying to modify whether the name of the report begins with F, P, or M, then using the BaseName property should do the trick. I tried it with both the Sequential and Parallel models and that statement worked for both. Let me know if this doesn't help.

0 Kudos
Message 2 of 7
(4,872 Views)

I think you have a merely linked problem as I had a few weeks ago.

I wanted to use the reportpath in a module, I also included <UUT_STATUS> in my expression.

However, in that case the path is not generated/converted until the test is completely done. (during the test it points to a temp directory)

My solution was to remove the <UUT_status> part.

 

Your case: you want to add a variable into your expression, but the variable is not yet set.

A possible reason for the error is that the report options are set in a different scope (global in teststand) then your sequence (in the file).

 

Maybe that a more advanced user can help you better?

 

 

 

0 Kudos
Message 3 of 7
(4,829 Views)

Artybear - I am assuming FileGlobals.Mode is located within your client sequence file. If that is the case, the reason you are seeing that error is due to the fact that your process model is the sequence file reading that expression and writing the file path, and since it is a seperate sequence file than your client sequence file, then FileGlobals.Mode doesn't exists. One simple option is using a StationGlobal instead of a FileGlobal. Since you are using the UUTStatus macro, the process model will wait to change ReportFilePath from a temp file to the permanent file until after MainSequence has been called.

 

Let me know if you would prefer not using a StationGlobal as there are other options, but it will require either process model results collection modification or using something like the PostUUT callback coupled with accessing the variable under RunState.ProcessModelClient.

 

HansWi - can you give me a little more background in the problem you were running into? At what point were you needing to access ReportPath? Why did you need to access it before Set Report is called?

0 Kudos
Message 4 of 7
(4,817 Views)

Apparently I forgot to mention (I also thought about it) that stationglobals would be a solution. That is indeed a good hint.

 

For my problem (that I solved already):

(I linked my forum thread in the post above)

I needed to acces the report path in the middle of the test to:

- create a directory: <report directory>/Data

-write html and png files with the names: <report directory>/Data/<report name>_device1.png ...  _device1.html

- include the picture in the report, together with a link to the HTML (measurement data)

 

Of course, on that moment the generate report path sequence does not know if the test will pass/fail/terminate, so I removed <UUT_status> from my expression.

Now reportpath is set on start of the test, so I can extract <reportdirectory> and <report file name> from the path.

 

Maybe it is possible to get the test status on the end of the test and add it to the report path manually.... But this has less priority for me now.

0 Kudos
Message 5 of 7
(4,801 Views)

Thank you for the replies! I'm out of the lab this whole week. I look forward to trying these tips next week.

 

-Arthur

0 Kudos
Message 6 of 7
(4,781 Views)
Solution
Accepted by topic author Artybear

My apologies for leaving this thread hanging. I finally got this figured out.

 

First, the ReportOptions callback can't add runtime info to the ReportOptions variable, because the callback gets called before the UUT number is entered (i.e. before the pre_uut callback).

 

Modifying the basename property, as suggested above, did not work for me, but the following similar code did work:

 

RunState.Root.Locals.ReportOptions.ReportFileSequentialModelExpression = "\"<ClientFileDir>\\\\TestStand Results\\\\" + Locals.Mode + "Test_<ClientFileName>_Report_PN<UUT>_<UUTStatus>_<Unique>.<FileExtension>\""

 

There are two gotchas:

 

1. The first you might notice is the double-escaping of the string. The ReportFileSequentialModelExpression is a string value, and, apparently, it must contain a value that can be evaluated as a string. So it needs extra quotes, which are escaped (\"), and then the escaped backslash needs to be doubled, so that the resulting string has an escaped backslash. 

 

2. The other gotcha is with the macros in the string (e.g. <UUT>, <Unique>, etc.). If they are entered in the "Report Options" dialog, then they must exist in the ReportFileSequentialModelExpression. Otherwise. TestStand gives the following error:

 

Details: List of macros used by expression of report file path cannot be modified during execution.

Code: -17500; Operation Failed.

Location: Step 'Determine Report File Path Expression' of sequence 'Test UUTs' in 'SequentialModel.Seq'

 

If you needed to change which macros are used, you may be able to do so using the ReportOptions callback, since it gets called so early in the execution. If that works, you may need to update the Parameters.ReportOptions.ReportPathMacroListString variable to contain all of the macros that you'll use during runtime. Kudos to anyone who verifies this possibility.

 

I hope that helps others who are looking for this capability.

Message 7 of 7
(4,713 Views)