Issue with blank varables in IIF statement.
Hey guys im having as issue where im using these 2 expressions in a table for coloumn 1/2 which will give a " " if the condition is correct. =IIF(IsNothing(Fields!FeeBasis.Value),Fields!WorkComp.Value/100, " ") =IIF(IsNothing(Fields!FeeBasis.Value),Code.SafeDivide( (Round(Fields!PostedActual.Value + Fields!UnPostedActual.Value)), Round(Fields!Budget.Value) ), " ") Now both of these work fine. However in the 3rd coloumn i need to devide one by the other. Im using this code =IIF(IsNothing(Fields!FeeBasis.Value),Code.SafeDivide(CDbl(ReportItems!txtWork.Value ) ,Round(ReportItems!txtUsed.Value * 100)/100)), nothing) Now this works fine for all fields even for 0 but when i get a " "/ Blank field i get an #error for that expression. Here is the code for my devide Function SafeDivide(ByVal numerator As Decimal, ByVal denominator As Decimal) As Decimal If (denominator = 0) Then Return 0 Else Return numerator / denominator End If End Function I really need some help with this as i have tried everything i can think of
November 22nd, 2011 8:46pm

Now i think i know whats causing it. The IIF statement will check both sides while running the report.
Free Windows Admin Tool Kit Click here and download it now
November 22nd, 2011 8:47pm

Now i think i know whats causing it. The IIF statement will check both sides while running the report.
November 23rd, 2011 4:22am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics