Using JavaScript in a Report Recipe
You can use JavaScript in HTML report recipes to make them more dynamic and add additional functionality to a report.
If there is something a PTC RV&Sreport tag cannot handle, it can most likely be done with JavaScript. for example, the Basic - HTML, Schedule report.
Example of JavaScript in a Report Recipe
Users are having difficulty following the item listings in reports. They would like alternating rows of the report to be highlighted in different colors. There are no PTC RV&S report tags or HTML that can do this.
Use JavaScript in a report recipe to display different colors for each item row in a report. Even rows will be one color and odd rows another.
For example:
<%version 1%>
<%description <b>Description: </b>This is a report that uses basic
PTC RVS report tags.<br><br>%>
<%param name="reporttitle" type="String" prompt="Report Title"
value="" description="Descriptive title for your report."%>
<%param name="reportheader" type="MultiString" prompt="Report
Header" value="" description="Text appearing at the top of
the report page."%>
<%param name="reportfooter" type="MultiString" prompt="Report
Footer" value="Confidential - Internal Use Only"
description="Text appearing at the bottom of the report page."%>
<html>
<head>
<title>Basic Report</title>
<%screenStyleSheet%>
<%printerStyleSheet%>
<script type="text/javascript">var line_count=0;</script>
</head>
<%dateformat%>
<%datetimeformat%>
<%sortby &sortby%>
<body>
<span class="logo"><%logoURL%></span>
<p class="title">&reporttitle</p>
<p class="header">&reportheader</p>
<div align="right" class="date"><%currentdate%></div>
<table class="display">
<tr><td colspan="&#fields"><hr class="hr_default"></td></tr>
<!-- Display item field headings -->
<tr>
<%iteratefields%>
<th class="heading1">&fielddisplayname</th>
<%/iteratefields%>
</tr> <tr><td colspan="&#fields"><hr class="hr_default"></td></tr>
<!-- Display item field values -->
<%begindetail%>
<script type="text/javascript">line_count++; if (line_count%2 == 0)
{document.write("<tr class='even_row'>");} else {document.write("<tr
class='odd_row'>");}</script>
<%iteratefields%>
<td class="border">&fieldname</td>
<%/iteratefields%>
</tr>\
<%enddetail%>
<tr><td colspan="&#fields"><hr class="hr_default"></td></tr>
</table>
<span class="footer">&reportfooter</span>
<div align="center">
<a href="<%weburl%>im/runreport?selection=¤tReportName">
<img src="<%weburl%>Report_Recipe/re-run_report.gif"
align="middle" border="0">
</a>
</div>
</body>
</html>