Compilation errors - Expression expected

Stimulsoft Reports.NET discussion
Post Reply
ddsmith99301
Posts: 52
Joined: Wed May 17, 2017 10:14 pm

Compilation errors - Expression expected

Post by ddsmith99301 »

I am getting two compilation errors when it tries to parse this line.

Public Sub DataBand1_Rendering(ByVal sender As Object, ByVal e As System.EventArgs)
IIF((Stimulsoft.Report.Dictionary.StiFunctionsDate.Year(QueryResults.Policy_Expiration_Date)) == (Stimulsoft.Report.Dictionary.StiFunctionsDate.Year(Today)), (SumTotalPremiumCurrentYear += QueryResults.Policy_Total_Premium), (SumTotalPremiumPreviousYear += QueryResults.Policy_Total_Premium))
End Sub
Compilation Errors.jpg
Compilation Errors.jpg (34.62 KiB) Viewed 3906 times
I attached the mrt file. Please take a look and let me know what I need to do to fix it.
Attachments
JGParker2.mrt
(21.07 KiB) Downloaded 388 times
Kubekin Yuriy
Posts: 10
Joined: Wed May 17, 2017 9:24 pm

Re: Compilation errors - Expression expected

Post by Kubekin Yuriy »

Hello, ddsmith99301.

We see unusual action. This issue is sent to our developers.
We will let you know when it will be fixed.

Thank you.
ddsmith99301
Posts: 52
Joined: Wed May 17, 2017 10:14 pm

Re: Compilation errors - Expression expected

Post by ddsmith99301 »

I did determine why it was giving me errors, but the IIF statement still doesn't work. I replaced the comparison operator '==' with '='. I am using VB not c#. I am using version 2013.3.1800

This is the statement that parses okay, but does not produce the expected result. Neither of the two variables is updated.
IIF((Year((QueryResults.Policy_Expiration_Date))=Year(Today)), SumTotalPremiumCurrentYear = SumTotalPremiumCurrentYear + (QueryResults.Policy_Total_Premium), SumTotalPremiumPreviousYear = SumTotalPremiumPreviousYear + (QueryResults.Policy_Total_Premium))

This statement works perfectly in the same event. So, I know it isn't that part of the IIF statement that is not working.
SumTotalPremiumCurrentYear = SumTotalPremiumCurrentYear + (QueryResults.Policy_Total_Premium)
ddsmith99301
Posts: 52
Joined: Wed May 17, 2017 10:14 pm

Re: Compilation errors - Expression expected

Post by ddsmith99301 »

This statement doesn't work either.

IIF(1=1,SumTotalPremiumCurrentYear = 20,SumTotalPremiumCurrentYear = 30)
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Compilation errors - Expression expected

Post by HighAley »

Hello.

Sorry, it's impossible to use the IIF function this way.
It should return false.
Please, try to use next expression:

Code: Select all

SumTotalPremiumCurrentYear = IIF(1=1, 20, 30)
Thank you.
Post Reply