Comparing variables against query result


Hi guys

I want to compare variables against query results. Lets say my query result 'seat_code' outputs A3, A4 as taken seats
so A1 and A2 are still free. (not in query result) I want to use conditional formating to set the background color of seat A3 and A4 to red.
The free seats have a white background color.
Think about an airplane floor plan seats availability. It is important to show more then 1 seat per row. Like first row on an airplane | A1 | A2 | 'isle' | A3 | A4 |
Conditional formating is executed when true. So if V{A3}==$F{seat_code} => Background color returns red.

Please advice how to fix this.

Greets A3an.

Hi all

I think I was not clear enough to what I want achieve.
Understanding conditional formatting is not the problem.
My query result gives me only the seats that are taken and I want to visualize them in red. The other (free) seats are for example green.
The thing is that I don't know how to compare the result set against every seat. Like: IF $V in result set is true apply conditional formatting.
I now the in_array() function in PHP but how to do this in Jaspersoft? Don't now much about Java....

I cannot put the seats in detail band because my result set will mulitply this by the number of rows of the result set. 
So what's the best solution to visualize seats? Should I use a textfield, table or maybe an image? I think a textfield will have the shortest executoin time.
I don't want to use a table because the seats are not always aligned this way.

Greets A3an

A3an's picture
Joined: Apr 10 2016 - 3:13am
Last seen: 1 day 7 hours ago

1 Answer:


Go to in Outline --> style --> right click on Style and Create Style --> right click on Style (you created) and click on create conditional Style. Put the conational whatever you want and style for that specific condition.

Image icon style1.png41.28 KB
Image icon style2.png110.78 KB
Sad H's picture
Joined: Sep 8 2020 - 5:58am
Last seen: 2 weeks 3 days ago