rcp rcp - 1 year ago 116
Java Question

DynamicJasper : Conditional style based on a hidden field

Just want to check, does dynamic jasper have any methods for PrintWhenExpression or Conditional style based on a hidden field, my situation is, i am trying to use addConditionalStyles with reference to a value of a hidden field.

For example, fields Name, Telephone Numbers are in the report, i just wanted to highlight all records for which location is 'XXX', where Location is not a visible field in the report, but included in the datasource

example case of conditional style usage

rcp rcp
Answer Source

I was able to solve this issue with the following suggestion from Juan Manuel Alvarez Gimenez of FDVSOLUTIONS, thanks Juan

If we need to use fields from the data source that are not directly shown on any column, we must register them like this:

DynamicReportBuilder drb = new DynamicReportBuilder();

drb.addField("location", String.class.getName());

This fields are now available to be used inside custom expressions, or if we use a template which has objects that references this fields

Reference http://dynamicjasper.com/2010/10/06/how-to-register-invisible-fields/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download