From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

conditional report file path

Solved!
Go to solution

Our project is using TestStand 2012 SP1.

We are using reportgen_txt.seq. and SequentialModel(.seq).

 

My goal is to save report files to a specific directory only when I run my Self_Test.seq.

I'm attempting to use Configure >> Report Options >> Generate Report File Path.

 

Setting in "Report Options" dialog >> "Generate Report File Path" tab:

 

Type Model: Sequential

File Name/Directory Options: Specify Report File Path by Expression

 

This is the expression that I'm using:

 

"<ClientFileName>" == "Self_Test" ? "C:\\Reports\\Self-test\\<ClientFileName>_Report[<UUT>][<FileTime>][<FileDate>]<Unique>.<FileExtension>" : "C:\\Reports\\<UUT>\\<ClientFileName>_Report[<UUT>][<FileTime>][<FileDate>]<Unique>.<FileExtension>"

 

The statment passes syntax check with "no errors".

Running Self_Test.seq using the sequence editor, the report file always goes to path in Red

Is there a method to accomplish this? 

0 Kudos
Message 1 of 7
(5,733 Views)

Do you need to add .seq to Self_Test in your conditional statement?  That would be my guess.  It's never evaluating to true because .seq isn't there.

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

Thanks for replying jaggawax,

I tried that, didn't work. So I tried modifying the setting to use a function from the f(x) palette:

 

!StrComp("<ClientFileName>", "Self_Test", 1, -1) ? "C:\\Reports\\Self-test\\<ClientFileName>_Report[<UUT>][<FileTime>][<FileDate>]<Unique>.<FileExtension>" : "C:\\Reports\\<UUT>\\<ClientFileName>_Report[<UUT>][<FileTime>][<FileDate>]<Unique>.<FileExtension>"

 

This still eveluates to: "C:\\Reports\\<UUT>\\<ClientFileName>_Report[<UUT>][<FileTime>][<FileDate>]<Unique>.<FileExtension>"

in the preview pane.

 

0 Kudos
Message 3 of 7
(5,716 Views)

What  comes out if you just use: "<ClientFileName>" ?

 

That's what you need to compare with.

 

Regards,

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

I think I know what's going on here.  It looks like the macro (<ClientFileName>) isn't evaluated until after your string compare occurs.  So you are comparing your file name to the macro (i.e. Self_Test is equal to <ClientFileName>)  Unfortunately, this won't compare correctly. 

 

I tried using an Evaluate function so the macro would evaluate first but no dice.  It throws an unexpected token error.

 

It looks to me like the macros don't evaluate until the end no matter what I've tried.  So I don't think your option is going to be valid.  Maybe one of hte blues can enlighten us on this as there is not documentation out there that I can find.

 

 

 

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 5 of 7
(5,659 Views)
Solution
Accepted by topic author Leroy_99

Hi Leroy/jigg,

 

You are correct that the expression itself is evaluated before the Macro strings are resolved, so this approach won't work.  The macros are evaluated using modelsupport2.dll (DetermineReportFilePathNameExprEx function), which first evaluates the expression before resolving the macros. For implementing a custom report file path expression for a particular client file, I would recommend overriding the ReportOptions callback, then programatically setting the report path expression, using an expression such as:

 

Parameters.ReportOptions.ReportFileSequentialModelExpression = "\"MyCustomLocation\\<ClientFileName>_Report[<FileTime>][<FileDate>].<FileExtension>\""

 

Note the use of double quotes since the field is an expression field.  This approach will also allow you to use logic in the callback to change the report file path string using TestStand flow control steps.

Al B.
Staff Software Engineer - TestStand
CTA/CLD
Message 6 of 7
(5,647 Views)

Thanks AI.B,

This will work for our application.
Ssince it is only Self_Test sequence that will need this modification, I'll place the override in that sequence file.

Thanks everyone for your help.

 

Leroy_99

0 Kudos
Message 7 of 7
(5,640 Views)