NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Specify Report File Path by Expression

Solved!
Go to solution

TS201x Help under "Specifying Report File Paths by Expression" talks about  using a number of various macros, but starts the page showing how to also use FileGlobals. When specifying the expression (... >>Specify Report File Path by Expression>>Expression Browser), I'd like to combine macros with FileGlobals, but none of the FileGlobals are listed i.e. available. The expression builder has access to the StationGlobals though, but not to the FileGlobals.

Is there a workaround, or at least an explanation, for this behaviour?

 

Cheers

 

0 Kudos
Message 1 of 5
(5,272 Views)

Because these settings can apply to a whole bunch of sequence files it cannot show your FileGlobals.  You can just put FileGlobals.MyReportName and then in each of your client sequence files create a FileGlobal named that.

 

You can use StationGlobals as well but I would avoid that as it could overwrite reports if you don't update it correctly.  Technically the same can be said for FileGlobals as well.

 

Another thing you might want to consider is checking to see if the property exists first:

PropertyExists("FileGlobals.MyReportName") ? FileGlobals.MyReportName : "Temp Report"

This way you won't get an error if it wasn't implemented in the sequence file.

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 5
(5,268 Views)

Thank for your quick reply!

 

So, I created the expression in the >>Specify Report File Path by Expression>>Expression Browser, using FileGlobals.MyReportName as per your suggestion.

Here, as expected, I got the first two error messages shown in the attached pdf.

 

I also made sure that my sequence has the FileGlobals.MyReportName defined.

 

When I run my sequence, I get the third error message shown in the attached pdf. I'd say this error message is also expected, since the non-listed FileGlobal

referred to in my expression created above, never reaches NI_ReportGenerator.seq i.e. modelsupport2.dll. Or perhaps I completely missed a point in your message?

 

In any case, please reply if you get a chance.

 

Cheers

 

0 Kudos
Message 3 of 5
(5,258 Views)
Solution
Accepted by topic author sukaba

I think you found a bug in the documentation.  In the older process models you could use the FileGlobals of the process model like that sentence states.  Now that they have moved to Plugins I don't think this is true anymore.  You may have to go with a StationGlobal on this one.

 

Or you can override the ReportOptions callback and change the Parameters.ReportOptions.ReportFileSequentialModelExpression variable to include the info from your client file.  So basically define a placeholder in your expression in the report options dialog.  Then in the callback use the SearAndReplace method to replace the placeholder with the specific data.  It worked for me when I tested it.  The nice thing about this way is you don't have to manage StationGlobals.

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 4 of 5
(5,230 Views)

Already worked it out through ReportOptions callback (via DirType, ModelExp and a few other parameters).
This seems like a more flexible way to handle this anyway.

Many thanks for tour time.

 

Cheers

0 Kudos
Message 5 of 5
(5,226 Views)