サーバー管理 > レポート > 高度なレポート レシピの記述 > レポート レシピでの JavaScript の使用
  
レポート レシピでの JavaScript の使用
JavaScript を HTML レポート レシピで使用すると、レポート レシピをさらに動的にし、レポートに機能を追加できます。
Windchill RV&S のレポートタグで処理できないレポートは、ほとんどの場合、JavaScript で処理することができます。たとえば、基本 - HTML、スケジュールレポートなどです。
レポート レシピでの JavaScript の例
レポートのアイテム リストを読みにくいという問題があるとします。そのため、レポートの行を 1 行おきに別の色でハイライトしたいと考えています。この操作を行うことができる Windchill RV&S レポート タグや HTML はありません。
レポート レシピで JavaScript を使用して、レポートのアイテム行を色分けします。偶数行をある色で表示し、奇数行を別の色で表示することにします。
次に例を示します。
<%version 1%>
<%description <b>Description: </b>This is a report that uses basic
Windchill 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=&currentReportName">
<img src="<%weburl%>Report_Recipe/re-run_report.gif"
align="middle" border="0">
</a>
</div>
</body>
</html>