NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting New File Path for Reports In Model

So, instead of overriding using callbacks I am trying to modify the SequentialModel/ReportGenerator to always store a file in a specific directory. I have modified to use a specific directory but seems, in the ReportGenerator.seq UUT Start, that the DetermineReportFilePathNameExprEx2 function always overrides any path I have created. This in return always stores the file in the directory the sequence is in when I am trying to create a folder, "Reports", and pass this "new" path directory to the model to use.

 

In the GetReportFilePath, in ReportGenerator Model, I have steps that create a specific folder in the working directory if not already created. I also store the path directory, of the created folder, in a string. Once this string is passed through it always gets overwritten and the report is put out in the current sequence directory. I have also changed the File/Directory Options to "Specify Report File Path By Expression".

0 Kudos
Message 1 of 7
(3,838 Views)

Could you insert a sequence call after the DetermineReportFilePathNameExprEx2 is called to override it?  In other words, call the sequence you created to designate the file path after the step that overwrites it.  You can highlight that step and then insert a "Sequence Call" and configure it appropriately (have it point to your sequenc).  Take this as a quick solution.  I believe there is certainly a better way.  (looking into it)

 

Just as extra resources, here are a couple links that may help with this and future questions:


Report Generation Explained
http://www.ni.com/white-paper/3977/en/

 

 

I also like an approach that one user took in a similar thread (sorry I could not find the appropriate person to credit for this):

 

"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."

 

 

 

 

Adam
0 Kudos
Message 2 of 7
(3,818 Views)

Thanks Mada. I will look over these comments. I did read yours. Since, one method, I used the GetReportFilePath callback to create my folder, and store the path, then tried to insert a sequence call to it before and after the DetermineReportFilePathNameExprEx2 function. Either way, the DetermineReportFilePathNameExprEx2 function would create the report file in the current sequence file directory regardless of what the parameters for file path/directory I passed into it. So, it seemed that the DetermineReportFilePathNameExprEx2 function created the file and displayed the file in the folder after execution of the function.

0 Kudos
Message 3 of 7
(3,811 Views)

Just to follow up, any luck so far Trey?

Adam
0 Kudos
Message 4 of 7
(3,784 Views)

Mada,

 

Have not been able to put any more effort into this due to being very busy with testing. I did kind of find a "work around" although it doesn't seem like a bad one. In the report processing options->report file pathname, I am using a modified file path:

"$(ClientFileDir)\\Reports\\$(ClientFileName)\\$(ClientFileName)_Report[$(FileTime)][$(FileDate)]$(Unique).$(FileExtension)"

 

This looks like it will create the folder, if not created, and store the files in a specified report directory.

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

Trey,

 

The beauty (and sometimes complexity) of TestStand is that there are many possible ways to solve an issue.  The trick is to understand the heirarchy of functions/callbacks to ensure that you get the desired result.  If this method works, I don't see that it would create any other conflicts.  If this customization can remain static, then I would consider it a viable solution.  Ideally you want to override callbacks by programming a new sequence or customizing the step as it seems you have in this case.

 

Please let me know if this gives you any further issues.

Adam
0 Kudos
Message 6 of 7
(3,765 Views)

You are right. Now that I think about it, I might try to find a way to modify the models to change the result options - "File/Directory Options" and "Report File Path" to what I have implemented now instead of what my original message stated. This would be a similar approach.

0 Kudos
Message 7 of 7
(3,759 Views)