Users can define their Groovy function and use it in TIBCO JasperReports® Server v6.4.0 Ad Hoc views.
The following are the steps needed to make this work.
Define Groovy function in BaseGroovyColumn.groovy file under deployed TIBCO JasperReports Server v6.4.0 WEB-INFgroovygroovy_column directory. For example:
def HelloWorld(String s) { return "Hello World ("+ s.trim() +")."; }
Expose newly defined Groovy function (from step 1) to Ad Hoc Designer web UI by adding the following function definition to applicationContext-el-operators.xml configuration file under deployed TIBCO JasperReports Server v6.4.0 WEB-INF directory. For example:
<bean parent="functionDef"> <property name="name" value="HelloWorld"/> <property name="javaType" value="java.lang.String"/> <property name="argumentTypes"> <list> <value>#{ objectTypeMapper.checkType('String') }</value> </list> </property> </bean>
Restart server;
Create Ad Hoc View from TIBCO JasperReports Server v6.4.0 Ad Hoc Designer;
Using the newly created Groovy function from the Ad Hoc custom calculated measure drop down list, create a calculated measure. For example:
Note: in this example, HelloWorld() function put a prefix literal to the concatenated user name created via another calculated measure.
Put the new custom measure to Ad Hoc View and the result is shown:
Since ad hoc calculated measures (vs Domain calculated fields) are generally processed in memory, we will not able to see those functions in ad hoc cache query. For example:
TTC-20171027
Recommended Comments
There are no comments to display.