NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

execution time in minutes and seconds

In the UUT Report, the Execution Time displays in seconds.  How can I get that to display in minutes and seconds.
0 Kudos
Message 1 of 11
(5,824 Views)

mrbean,

This thread mentions two ways to modify the report to get the minute formatting. One is the within the sequence, another is by modifying the style sheet. 

I think the easier way is to modify the style sheet located in <TestStand>\Components\NI\Models\TestStandModels\StyleSheets\report.xsl.  There is a C style function that gets the time which you can modify.  I have highlighted the line that outputs the time value to the report.

function GetTotalTime(nodelist){
    if (gIncludeTimes){
        var node = nodelist.item(0);
        var text = node ? node.text : "";
       
return "<TR><TD NOWRAP='NOWRAP'><B><LI> Execution Time: </LI></B></TD><TD><B>" + ((text == '') ? "N/A" : (text + " seconds")) + "</B></TD></TR>";
    }
    else
        return "";
}

You can simply calculate the minute values before this line and then format the output string to contain those values and labels.

John B.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 11
(5,802 Views)
Is the style sheet used regardless of the type of report output selected (html, atml, txt), or is this only applicable to ATML?
 
If I went the c-function route, where would I find this function?  Is it in the modelsupport2.dll.  Would this require use of CVI and rebuild of the DLL?
0 Kudos
Message 3 of 11
(5,797 Views)

"modify the style sheet located in <TestStand>\Components\NI\Models\TestStandModels\StyleSheets\report.xsl.  There is a C style function that gets the time which you can modify."

You just have to open the above file and find this function.

The html report is generated by reportgen_html.seq and the txt report is generated by reportgen_txt.seq. Like the atml and xml sequences, the elapsed time is reported in the AddReportHeader sequence by steps called 'AddExecutionTime'. These do not use style sheets. You would have to modify each step in each sequence.

0 Kudos
Message 4 of 11
(5,788 Views)
I'm already making mods to the (sequential) process model sequence file.  Are there particular settings that I can override in the ReportOptions.DateAndTime.Format (I've overriden the ReportOptions callback so that I can set things like onthefly reporting, .html formatting, directory, etc)
0 Kudos
Message 5 of 11
(5,650 Views)
mrbean,
 
The DateAndTimeFormat option is designed to modify the way TestStand names the Report File that we generate.  You can set the options on a station wide basis using Configure»Report Options or using this parameter.  The two common values it accepts are "DateFirst" or "TimeFirst" dictating which dictate the order those elements appear in the file name.  If you are thinking of using this in relation to the original question of this thread, I dont believe is has any bearing on the way the times values are displayed in the report, just the name of the report.  I think you still need to modify the reportgen_html sequence as mentioned above to change the way the execution time will display in your reports.
John B.
Applications Engineer
National Instruments
0 Kudos
Message 6 of 11
(5,627 Views)
Currently the date portion of the date/time appears as dd-mm-yyyy.  Is there a way to get it in YYYY-mm-dd format?
0 Kudos
Message 7 of 11
(5,620 Views)

mrbean,

Yes you can change the format of the dates in TestStand.  As this KnowledgeBase article points out you could simply change the date format for Windows, or you can use the custom Date() and Time() functions to build your own format.

John B.
Applications Engineer
National Instruments
0 Kudos
Message 8 of 11
(5,575 Views)

I'm just now getting to this, and I've decided to address this in the reportgen_html.seq.  In the step labelled "Add Execution Time", the expression reads,

Locals.Header += "<TR><TD NOWRAP='NOWRAP'><B><LI>" + ResStr("MODEL", "RPT_HEADER_EXEC_TIME") + "</B><TD><B>" + (PropertyExists("Parameters.MainSequenceResults.TS.TotalTime") ? Str(Parameters.MainSequenceResults.TS.TotalTime, Parameters.ReportOptions.NumericFormat , 1, True) + ResStr("MODEL", "RPT_HEADER_SECONDS") : ResStr("MODEL", "RPT_NOT_APPLICABLE")) + "</B>\n"

I found the RPT_HEADER_SECONDS constant and changed it to _MINUTES and changed the string.   I divided the Parameters.MainSequenceResults.TS.TotalTime by 60, and this all seems to work.  The only thing that's not working is that I'm updating the Parameters.ReportOptions.NumericFormat, and no matter what I do it keeps showing me 13 decimal points. 

The Parameters.ReportOptions.NumericFormat is set to  %$.13f  (but I've tried several variations). 

I just want it to display something like   21.63 minutes.  Also, what is the $ doing in that expression

0 Kudos
Message 9 of 11
(5,289 Views)

I found that if I added to the ReportOptions callback of my application's sequence file, a statement like

Parameters.ReportOptions.NumericFormat="%.2f"

everything worked fine.

0 Kudos
Message 10 of 11
(5,271 Views)