Default value when column has data in

0

Hi Guys,

I am developing a report and I want to create a custom field that displays 'Y' or 'N' depending on criteria.

As an example the report currently has the following data:

Make Colour Seats
Mazda Red 2
BMW Silver 4

I would like to have a column like below based on criteria:

Make Colour Seats Is Convertible?
Mazda Red 2 Y
BMW Silver 4 N

The column 'is convertible' must be based on the 'Seats' column. 

Thanks,

 

Chris

chris_latham1's picture
Joined: Jan 29 2014 - 3:01am
Last seen: 6 years 8 months ago

1 Answer:

1

You can use ternary conditional assignment in your report field expression to derive 'is convertible' value based on 'Seats' content. Something like:

$F{Seats}.intValue()==2?"Y":"N"

 

tchen's picture
71286
Joined: Feb 27 2008 - 7:33am
Last seen: 1 day 11 hours ago

alternatively you could add another column into your database query, that did some sort of case statement, ie;

CASE WHEN SEATS = 2 THEN 'Y' ELSE 'N' END as IS_CONVERTIBLE

butlerc - 6 years 8 months ago
Feedback
randomness