webform:name of webform
04 April 2016
As of 2011.1, support for using a webform as pre-process page is possible. To use a webform as pre process page, you simple define the value of the pre-process-page setting as below:
webform:name of webform
When this syntax is used, the pre process page will be generated by the
/common/emxFormEditDisplay.jsp
page (not part of TVC / TVC Report
generator).
Using a webform as pre process page can only be used for non-global reports. E.g. an object-id must be available (this is a limitation of the web-form framework). |
There is a possibility to have a pre-process page that is executed before the report is being created. Such page could be used to have more interaction with the user, for example defining runtime parameters that impact the report layout and/or content.
Within the report definition, you define the context-relative URL for the pre process page to be used. Context-relative means that you should skip the web-application name, for example if the web-application is called ematrix and your custom pre-process page is under /ematrix/custom/preprocess1.jsp – then the attribute should contain following: /custom/preprocess1.jsp.
Since the pre-processing page is a JSP page, almost any logic may be done on this page. But, typically the general idea with this page is to allow:
Overriding settings in the Report Definition instance
Defining custom transformer properties
An example of a pre-process page is provided among the web-application
files that are installed with the report generator:
tvx/enc/EBOMSummaryPreProcessPage.jsp
.
The request parameters that are submitted from the pre-process page must have one of three different prefixes, in order for the report generator to know how to handle them. These prefixes are:
Parameter Prefix | Description |
---|---|
convProps. |
May be used to submit a parameter that typically is defined within the "TVC Conversion Properties" attribute. Example:
|
runtime. |
May be used to submit a parameter that overrides an attribute that is defined on the Report Definition instance. The attribute that is being overridden should be referred to with its symbolic name. Example:
|
transformer. |
Defines a parameter that is passed to the stylesheet during conversion. Example:
|
The URL used to start the report creation from a pre-process page is generated by using following JSP custom tag:
<%@ taglib uri="/WEB-INF/tvc-reportgenerator.tld" prefix="rg" %>
<form action="<rg:writePreProcessPageSubmitAction/>"
The definition types "Expansion Report" and "Inquiry Report" are both using a "Table". Sometimes it is useful to allow the user to select columns to be included in the table. Following JSP code does this:
<%@ include file="/tvc/core/tvcSetContentType.jspf" %>
<%@ taglib uri="/WEB-INF/tvc-core.tld" prefix="core" %>
<%@ taglib uri="/WEB-INF/tvc-reportgenerator.tld" prefix="rg" %>
<core:checkLogon/>
<core:noCache/>
<rg:report id="report"/>
<html>
<head></head>
<body>
<form action="<rg:writePreProcessPageSubmitAction/>" method="post">
<rg:hasTableColumns name="report">
<table border="0" cellspacing="2" cellpadding="3">
<tr>
<td class="label" nowrap width=100>Select Columns</td>
<td class="inputField" nowrap>
<rg:tableColumnChooser name="report"/>
</td>
</tr>
</table>
</rg:hasTableColumns>
</form>
</body>
</html>
The definition type "Advanced Report" is built up by sections. The user can select sections that should be included / excluded from the report. Following JSP code does this:
<%@ include file="/tvc/core/tvcSetContentType.jspf" %>
<%@ taglib uri="/WEB-INF/tvc-core.tld" prefix="core" %>
<%@ taglib uri="/WEB-INF/tvc-reportgenerator.tld" prefix="rg" %>
<core:checkLogon/>
<core:noCache/>
<rg:report id="report"/>
<html>
<head></head>
<body>
<form action="<rg:writePreProcessPageSubmitAction/>" method="post">
<rg:hasSection name="report">
<table border="0" cellspacing="2" cellpadding="3">
<tr>
<td class="label" nowrap width=100>Select Columns</td>
<td class="inputField" nowrap>
<rg:sectionChooser name="report"/>
</td>
</tr>
</table>
</rg:hasSection>
</form>
</body>
</html>
A pre process page example showing how to add a printer selector is shown below. The bold marked sections show the related code for the printer selector. Everything else is just there for illustration purposes on how to create a complete working example.
<%@ include file="/tvc/core/tvcSetContentType.jspf" %>
<%@ taglib uri="/WEB-INF/tvc-core.tld" prefix="core" %>
<%@ taglib uri="/WEB-INF/tvc-struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tvc-reportgenerator.tld" prefix="rg" %>
<%@ taglib uri="/WEB-INF/tvc-reportgenerator-outputhandler.tld" prefix="oh" %>
<core:checkLogon />
<core:noCache />
<html>
<head>
<core:tvcBase/>
<core:themeArtifact id="tvc-form"/>
<script type="text/javascript"
src="reportgenerator/js/tvcPreProcessPageScripts.js">
</script>
<oh:printerSelector disposition="head"/>
<script type="text/javascript">
tvcSetSubmitFunction(doSubmitForm);
function doSubmitForm() {
var printers = getSelectedPrinters();
if (printers == null) {
parent.frames["createBottom"].private_tvcSetContinueEnabled(true);
alert("Please select a printer");
} else {
document.forms[0].elements["convProps.print.printers"].value = printers.join(",");
document.forms[0].submit();
}
}
</script>
</head>
<body>
<form action="<rg:writePreProcessPageSubmitAction/>" method="post" style="margin:0px;padding:0px;">
<input type="hidden" name="convProps.print.printers" />
<table border="0" width="99%">
<tr>
<td class="label" nowrap width=100>Select Printer</td>
</tr>
<tr>
<td class="inputField" nowrap>
<oh:printerSelector disposition="content"/>
</td>
</tr>
</table>
</form>
</body>
</html>