&&(and) operator in IFF condition

Stimulsoft Reports.WEB discussion
Post Reply
Vikas
Posts: 20
Joined: Sat Jul 31, 2010 4:12 am
Location: Delhi

&&(and) operator in IFF condition

Post by Vikas »

Hi

I am using the below code

{
IIF((Math.Round((Sum(DownloadTourMaster.CalculateAssigned)/Totals.Count(DataBand1)))>0) &&(Math.Round((Sum(DownloadTourMaster.CalculateTourHit)/Totals.Count(DataBand1)))>0),
(Math.Round((Sum(DownloadTourMaster.CalculateAssigned)/Totals.Count(DataBand1)) / (Math.Round((Sum(DownloadTourMaster.CalculateTourHit)/Totals.Count(DataBand1))
,
"N/A ( > 1.0 is tours too slow; <1.0 is tours too fast )"
)
}

but && operaotr is not working. Its checking the first condition. and showing error as Attempt to zero divide exception.

My first two condition is true.
1. How we use the && operator in two condition?
2. How we divide one value to another?

Thanks
Vikas








Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

&&(and) operator in IFF condition

Post by Alex K. »

Hello,

The && operator works correctly. The error occurs because division by 0 is in your expression.
Please use the following code:

Code: Select all

IIF((Math.Round(Div(Sum(DownloadTourMaster.CalculateAssigned),Totals.Count(DataBand1)))>0) &&(Math.Round(Div(Sum(DownloadTourMaster.CalculateTourHit),Totals.Count(DataBand1)))>0),
Div(Math.Round(Div(Sum(DownloadTourMaster.CalculateAssigned),Totals.Count(DataBand1))), Math.Round(Div(Sum(DownloadTourMaster.CalculateTourHit),Totals.Count(DataBand1)))),
"N/A ( > 1.0 is tours too slow; <1.0 is tours too fast )")}
Thank you.
Post Reply