Conditional expressions?

Hello every one. I'm new to iReport. I am trying to generate a report that has this structure :

The fields retreived from database :

  • P_AMOUNT
  • P_CURRENCY

and basicaly, I am asked to sum the values within a criteria, Currency. I have USD, and EUR as currencies, and the AMOUNT is in one of the two currencies I mentioned.

I created 2 variables in my Report called : USD_TOTAL and EUR_TOTAL, but I don't know how can I write an expression for those varaibles tocalculate the 2 sums. Can you please help me?

It's really urgent.

thx in advance

elmoualh's picture
Joined: Jul 19 2010 - 11:30pm
Last seen: 13 years 2 months ago

4 Answers:

u can use sql query for sum  in your report query.

nibedita's picture
521
Joined: Nov 19 2008 - 1:52am
Last seen: 8 years 9 months ago

I have tried but It didn't work, and I tried to use multiple queries but it took only the first one :S

 

elmoualh's picture
Joined: Jul 19 2010 - 11:30pm
Last seen: 13 years 2 months ago

 just create a variable and set the properties 

for caluculation --sum

and for variable Exp--put the if condition

let me know if it works

 

jasperforum's picture
Joined: Jul 16 2010 - 5:48am
Last seen: 13 years 2 months ago

thx for your reply.

I reanalized my SQL Query and managed to simulate the formula in SQL, and I imported the calculated values into my report, and it worked.

Thank you again,

Regards

elmoualh's picture
Joined: Jul 19 2010 - 11:30pm
Last seen: 13 years 2 months ago
Feedback
randomness