Page 1 of 1

&&(and) operator in IFF condition

Posted: Wed Aug 11, 2010 3:37 am
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









&&(and) operator in IFF condition

Posted: Wed Aug 11, 2010 7:56 am
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.