Format text field depending on database value

Hello everybody,

I'm using a table component to display a wide range of data. This data is catagorized by ID's and some categories should be displayed with bold text. For example the first row is Category 1 and Category 1 should be printed with bold text. The row of Category 2 than should be formatted with normal style. So there a some single rows in the table that should be printed with bold text. What is the best way to realize that? I try this bit it did not bring a change:

($F{Param1} == "1") ? "<style isBold='true'>" + $F{Param2} + "</style>" : $F{Param2}

Thanks for any hint!

mpolo91's picture
Joined: Nov 30 2022 - 8:23am
Last seen: 1 month 1 week ago

Did no one have an idea how making text for special categories bold can work in jaspersoft?

mpolo91 - 4 months 1 week ago

In this case the equality check with object.equals(object) solves the issue. Like this: `($F{Param1}.equals("1"))`

mpolo91 - 3 months 2 weeks ago

1 Answer:

I would check out conditional styles in Studio. You can add styles with conditions (which can be Java checks against fields such as your examples). Then, you simply set the Style property for the field you want dynamically displayed to the Style you created. More details here:

mbielkiewicz's picture
Joined: Feb 23 2014 - 9:22pm
Last seen: 1 day 9 hours ago