「新規 EGL レポート・ハンドラー (New EGL Report Handler)」ウィザードを使用してレポート・ハンドラーを作成したくない場合は、 手操作でレポート・ハンドラーを作成できます。
このコードをコピーし、ご使用のアプリケーションに合わせて変更することができます。
手操作でレポート・ハンドラーを作成するための構文を示すサンプル・コード
handler handlerName type jasperReport // Use Declarations (optional) use usePartReference; // Constant Declarations (optional) const constantName constantType = literal; // Data Declarations (optional) identifierName declarationType; // Pre-defined Jasper callback functions (optional) function beforeReportInit() ... end function afterReportInit() ... end function beforePageInit() ... end function afterPageInit() ... end function beforeColumnInit() ... end function afterColumnInit() ... end function beforeGroupInit(stringVariable string) ... end function afterGroupInit(stringVariable string) ... end function beforeDetailEval() ... end function afterDetailEval() ... end // User-defined functions (optional) function myFirstFunction() ... end function mySecondFunction() ... endend
レポート・パラメーターの取得方法を示す例
handler myReportHandler type jasperReport // Data Declarations report_title String; // Jasper callback function function beforeReportInit() ... report_title = getReportTitle(); ... end ... // User-defined function function getReportTitle() Returns (String) return (getReportParameter("ReportTitle")); end end
レポート変数を設定し、取得する方法を示す例
handler myReportHandler type jasperReport // Data Declarations employee_serial_number int; // Jasper callback function function afterPageInit() ... employee_serial_number = getSerialNumberVar(); ... end ... // User-defined function function getSerialNumberVar() Returns (int) employeeName String; employeeName = "Ficus, Joe"; setReportVariableValue("employeeNameVar", employeeName); return (getReportVariableValue("employeeSerialNumVar")); end end
レポート・ハンドラー内のレポート・フィールド値の取得方法を示す例
handler myReportHandler type jasperReport // Data Declarations employee_first_name String; // Jasper callback function function beforeColumnInit() ... employee_first_name = getFirstNameField(); ... end ... // User-defined function function getFirstNameField() Returns (String) fldName String; fldName = "fname"; return (getFieldValue(fldName)); end end
レポート・ハンドラーでレポート・データ・フレキシブル・レコードを追加する方法を示す例
handler myReportHandler type jasperReport // Data Declarations customer_array customerRecordType[]; c customerRecordType; // Jasper callback function function beforeReportInit() customer ReportData; datasetName String; //create the ReportData object for the Customer subreport c.customer_num = getFieldValue("c_customer_num"); c.fname = getFieldValue("c_fname"); c.lname = getFieldValue("c_lname"); c.company = getFieldValue("c_company"); c.address1 = getFieldValue("c_address1"); c.address2 = getFieldValue("c_address2"); c.city = getFieldValue("c_city"); c.state = getFieldValue("c_state"); c.zipcode = getFieldValue("c_zipcode"); c.phone = getFieldValue("c_phone"); customer_array.appendElement(c); customer.data = customer_array; datasetName = "customer"; addReportData(customer, datasetName); end end
XML 設計文書がレポート・ハンドラーからレポート・データ・レコードを取得する方法を示す例
<jasperReport name="MasterReport" scriptletClass="subreports.SubReportHandler"> ... <subreport> <dataSourceExpression> <![CDATA[(JRDataSource)(((subreports.SubReportHandler) $P{REPORT_SCRIPTLET}).getReportData( new String("customer")))]]> </dataSourceExpression> <subreportExpression class="java.lang.String"> <![CDATA["C:/RAD/workspaces/Customer.jasper"]]> </subreportExpression> </subreport> ... </jasperReport>
関連する概念
EGL レポートの概要
EGL レポート作成プロセスの概要
関連するタスク
EGL ソース・ファイルの作成
EGL レポート・ハンドラーの作成
レポート・テンプレートの使用
関連する参照項目
EGL Report ライブラリー
EGL レポート・ハンドラー
事前定義されたレポート・ハンドラー関数
追加の EGL レポート・ハンドラー関数