How do I add text after number to show on a report ? Price Model

Hi Guys

Complete beginner here... just need to change one thing on my current report.

I need to change the following so that each number 1:  2:  3: says instead 1 week:  2 weeks:  3 weeks: and so forth... 

Below is what I currently have - all works fine part of the report but just reports out the number. I need to it say the text aswell... 

 

$F{priceModel}.equals("1 day week") ?

(

$F{timeQty} >= 1 && $F{timeQty} <= 7 ?

1  :

$F{timeQty} >= 8 && $F{timeQty} <= 14  ?

2  :

$F{timeQty} >= 15 && $F{timeQty} <= 21  ?

3  :

$F{timeQty} >= 22  ?

4  :

$F{timeQty}

)

:

 

Thanks Guys! Any help would be apprecaited!

Thanks! 

slam_jam_cooper's picture
Joined: Apr 6 2020 - 7:09am
Last seen: 3 years 4 months ago

1 Answer:

You can use the built-in TEXT() function to convert the number to a string.

$P{timeQty} >= 1 && $P{timeQty} <= 7        ? "1 week"
  : $P{timeQty} >= 8 && $P{timeQty} <= 14   ? "2 week"
  : $P{timeQty} >= 15 && $P{timeQty} <= 21  ? "3 week"
  : $P{timeQty} >= 22                       ? "4 week"
  : TEXT($P{timeQty},"#,###")

jgust's picture
6528
Joined: Jun 10 2010 - 6:39am
Last seen: 48 min 11 sec ago
Feedback