Calculating a value of a field with iif rule in report

  • Thread starter Thread starter Svetac
  • Start date Start date
S

Svetac

Hi folks,
I've created a report that has text field A which is a sum of other
fields and it changes depending on ProductID.
I have a text field B that should have value depending on value of
text field A as follows:
If A is < 3000 then B = 80
If A is between 3000 and 6000 then B = 160
If A is between 6000 and 9000 then B = 250
If A is between 9000 and 12000 then B = 330
If A is between 12000 and 15000 then B = 400
If A is > 15000 then B = 500+X where X=(A-15000)*0,01 but if the
result of "(A-15000)*0,01" is >5000 then X=5000.

Can this be done with iif rule in Expression Builder? Or I need a
function?
Any help would be appreciated.
JJ
 
Hi folks,
I've created a report that has text field A which is a sum of other
fields and it changes depending on ProductID.
I have a text field B that should have value depending on value of
text field A as follows:
If A is  < 3000 then B = 80
If A is  between 3000 and  6000 then B = 160
If A is  between 6000 and 9000 then B = 250
If A is  between 9000 and 12000 then B = 330
If A is  between 12000 and 15000 then B = 400
If A is  > 15000 then B = 500+X where X=(A-15000)*0,01 but if the
result of "(A-15000)*0,01" is >5000 then X=5000.

Can this be done with iif rule in Expression Builder? Or I need a
function?
Any help would be appreciated.
JJ

It can be done in both ways.

I think a function is the best way.
The IIF will have a lot of nesting levels which makes it hard to
write. In a function you can use the Select Case instruction. That
helps you to get a clear view, no matter the number of levels.

Groeten,

Peter
http://access.xps350.com
 
Back
Top