Adding Variables for reports

Exchange HTML report templates between users.
Post Reply
RRing
Posts: 39
Joined: Wed Aug 16, 2006 9:14 am

Adding Variables for reports

Post by RRing »

I am trying to create a report and need to combine 2 variables together to get a final result for uptime. Example, %FolderAverage_AliveTime% + %FolderAverage_UnknownTime% . I am new at creating reports and am trying to do this in Custom HTML, But am totally lost. Trying for a report with following fields
Folder - Alive+Unknown - Dead - PassedTest+UnknownTest - Dead

Do you have more detailed examples on how I can do this? Thank you
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Re: Adding Variables for reports

Post by KS-Soft Europe »

RRing wrote:I am trying to create a report and need to combine 2 variables together to get a final result for uptime. Example, %FolderAverage_AliveTime% + %FolderAverage_UnknownTime%.
It is posible to add variables using Java script and document.writefunction. For example, to calculate PassedTest+UnknownTest value you place the following code somewhere in "Folder Title" tab of "HTML Report tepmplate" window :

Code: Select all

<SCRIPT type="text/javascript">
  var passed_tests = %FolderTotal_PassedTests% + %FolderTotal_UnknownTests%;
    document.write("<TR><TD>Total Passed tests : </TD><TD>"+passed_tests+"</TD></TR>");
</script>
Of course it is just an exampe, and you may specify any HTML tags as parameter for document.write function.

However, it is almost impossible to add %FolderAverage_AliveTime% and %FolderAverage_UnknownTime%. These variables represent time, so to add two time variables you should convert them to date using Date object of Javascript. You may try if you want.
RRing wrote:I am new at creating reports and am trying to do this in Custom HTML, But am totally lost. Trying for a report with following fields
Folder - Alive+Unknown - Dead - PassedTest+UnknownTest - Dead
You may try to add the following code into in "Folder Title" tab of "HTML Report tepmplate" window of certain "Custom HTML" report:

Code: Select all

<SCRIPT type="text/javascript">
   alive_var = %FolderAverage_AliveRatio% + %FolderAverage_UnknownRatio%;
   passed_var = %FolderTotal_PassedTests% + %FolderTotal_UnknownTests%;
   document.write("<tr><td><b>%Folder% 126</td><td>"+alive_var+"</td><td>%FolderAverage_DeadRatio%</td><td>"+passed_var+"</td><td>%FolderTotal_FailedTests%</td></tr>");
</script>
Regards,
Max
Post Reply