Trying to dynamically style a crosstab


I am trying to style a cross tab based on data that is read in.  I am using Jaspersoft Studio to edit the report.

I have found I can change the background color of a textfield in the crosstab like this

<reportElement style="Alt_Color" x="0" y="0" width="60" height="20" uuid="1285034f-6b3e-4181-bcdd-4d2e5ff03102">

<propertyExpression name=""><![CDATA["#EEEEEE"]]></propertyExpression>


And I can put in a parameter in the place of the color and that works when I put in a value in the parameter.

What I would like is to use a field value read in from the data in place of the current color I have specified.  The problem is I can't seem to use field variables in this location.  It says it can't be found.  

Is there a way to pass field variables to a crosstab?  Can a field variable be made into a parameter and then passed to the crosstab?

Been trying for quite a while and can't seem to figure it out.



kimr's picture
Joined: Apr 11 2023 - 9:56am
Last seen: 3 months 3 weeks ago

1 Answer:

Crosstabs display aggregated data and one cell can correspond to several records in the data source.  For that reason field values cannot be used directly in crosstabs, you need to pass field values as crosstab groups and use the group variables to display the values.  You can also use crosstab parameters but only when there is a single value to be passed, that is when the value does not change from one row/column to another.



lucianc's picture
Joined: Jul 17 2006 - 1:10am
Last seen: 6 hours 3 min ago