Page 1 of 1

"Sum doesn't exist in the current context" in nested IIF

Posted: Thu Feb 14, 2013 8:12 pm
by Fabio Pagano
In a text field i have the following expression (nested "IIF"):

Code: Select all

{IIF(Sum(Movimenti.Saldo)>=0,"Utile del periodo",IIF(Sum(Movimenti.Saldo)<0,"Perdita del periodo",""))}
When i run the report, i receive the following error:

"Sum name doesn't exist in the current context".

If I replace the second "Sum" with another condition (say "1<0"), no error appears

Code: Select all

{IIF(Sum(Movimenti.Saldo)>=0,"Utile del periodo",IIF(1<0,"Perdita del periodo",""))}
It seems that the problem is in the sum in a nested IIF.

Thank you.

Re: "Sum doesn't exist in the current context" in nested IIF

Posted: Fri Feb 15, 2013 1:22 pm
by Alex K.
Hello,

Can you please send us a sample report with test data for analysis.

Thank you.

Re: "Sum doesn't exist in the current context" in nested IIF

Posted: Fri Feb 15, 2013 3:55 pm
by Fabio Pagano
Attached is a sample report and data.

The error is in the field "Text2" in the group footer.

Thank you.

Re: "Sum doesn't exist in the current context" in nested IIF

Posted: Mon Feb 18, 2013 6:22 am
by HighAley
Hello.

We have reproduced your issue. We need some time to give you an answer.
For a while you could set the Calculation Mode property of the report to Interpretation.

Thank you.

Re: "Sum doesn't exist in the current context" in nested IIF

Posted: Tue Feb 19, 2013 7:42 am
by HighAley
Hello.

Please, to use ?: operator instead of the IIF() function. Your expression will be next:

Code: Select all

{IIF(Sum(Data.IDCustomer)>=0,"Utile del periodo", Sum(Data.IDCustomer)<0 ? "Perdita del periodo" : "")}
Thank you.

Re: "Sum doesn't exist in the current context" in nested IIF

Posted: Mon Nov 30, 2015 6:38 pm
by Fabio Pagano
Good evening.

Now i'm using version 2015.2.0.0 and the following sample statement (based on what you've suggested):

Code: Select all

{IIF(Sum(0)>=0,"Utile del periodo", Sum(0)<0 ? "Perdita del periodo" : "")}
gives the following error:

'There is no matching overloaded method for "IIF(Object,Int32,Object)'

when i press the button "Check" in the editor.

Anyway, the statement works fine in report, only the "Check" button in the editor gives the above error (so it's not a problem at the moment).

Thank you.

Re: "Sum doesn't exist in the current context" in nested IIF

Posted: Tue Dec 01, 2015 2:07 pm
by HighAley
Hello. Fabio.

We have reproduced the issue.
We will let you know about results soon.

Thank you.

Re: "Sum doesn't exist in the current context" in nested IIF

Posted: Tue Dec 01, 2015 10:39 pm
by Ivan
Hello,

The problem is solved.
The patch will be available in the next prerelease build.

Thank you.