IIF in text component with divisions -> errors
Posted: Mon Dec 05, 2011 1:40 pm
Hi all,
I'm facing a crazy problem, can't manage to fix it by myself, although it looks quite simple.
In the text editor of a text component, I typed this code:
When I display the report with the data, this code doesn't work properly. I got errors "Attempted to divide by zero", although I take into account those divisions by zero in the code, with the conditions.
Thing that is strange is that if I replace the 2 divisions included in the code by simple text (like "blahblah"), everything is working fine, data are going to the good "if" according to what values are null.
I tried everything, changed "==0" with "==null", changed the condition sequence, etc... I'm going nuts! As soon as I add a division, report fails!
On this link you will find the report and data sample (data as they are when doing "View data" with the "real" report, from the DB. Maybe you'll need to change "null" data to "0", I don't know exactly how the csv should look like in that case).
Could you please help me?
Hope this is understandable. I can join screenshots if it helps.
Thanks!
I'm facing a crazy problem, can't manage to fix it by myself, although it looks quite simple.
In the text editor of a text component, I typed this code:
Code: Select all
{IIF(Sowing.number_of_seeds==0,
"?",
IIF(Sowing.fruit_number==0,
IIF (Sowing.number_of_young_plants==0,
"?",
Sowing.number_of_seeds/Sowing.number_of_young_plants),
Sowing.number_of_seeds/Sowing.fruit_number))}
Thing that is strange is that if I replace the 2 divisions included in the code by simple text (like "blahblah"), everything is working fine, data are going to the good "if" according to what values are null.
I tried everything, changed "==0" with "==null", changed the condition sequence, etc... I'm going nuts! As soon as I add a division, report fails!
On this link you will find the report and data sample (data as they are when doing "View data" with the "real" report, from the DB. Maybe you'll need to change "null" data to "0", I don't know exactly how the csv should look like in that case).
Could you please help me?
Hope this is understandable. I can join screenshots if it helps.
Thanks!