Calculations in a report

beatlejus

Member²
Hi,

many thanks first of all for your prompt replies here.

In a report I have to fields:
invoice_value, statistic_value
and I would like to have the following calculations:
invoice_value < 1000 EUR, statistic_value * 1,05
invoice_value > 1000 EUR, statistic_value / 1,05

Is that possible?

------------------
--
Rgds,
Norbert
 
Yes, but only in SQL. First you need an expression that indicates whether the invoice value is less than 1000 (does equal to 1000 matter?):
Code:
sign(1000 - invoice_value)
This returns -1 if the value is less than 1000, 0 if it is 1000, and 1 if it is greater than 1000. You can decode this to your factor:
Code:
select ...,
       decode(sign(1000 - invoice_value),
              -1, statistic_value * 1.05,
              1, statistic_value / 1.05,
              0, ???)
  from ...
This should perform your calculation in SQL.

------------------
Marco Kalter
Allround Automations
 
Back
Top