rcp rcp - 28 days ago 19
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
http://dynamicjasper.com/2010/10/06/how-to-use-conditional-styles/

rcp rcp
Answer

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/

Comments