locked
Visual Studio #Error message RRS feed

  • Question

  • I am designing a report in visual studio.  In one of my calculations I am doing I keep getting a #ERROR when it is displayed.  I thought I had done every combination to check for zeros but am still getting the error message.

     

    Here is the formula that I am using:

     

    =iif((Fields!n_forecasted.Value)=0 or (Fields!answered.Value) = 0 or (Fields!handlesecs.Value) = 0 or (Fields!f_handlesecs.value) = 0 or ((Fields!handlesecs.Value) / (Fields!answered.Value)) = 0 or ((Fields!f_handlesecs.Value)/(Fields!n_forecasted.Value)) = 0, 0, ((Fields!handlesecs.Value) / (Fields!answered.Value))/((Fields!f_handlesecs.Value)/(Fields!n_forecasted.Value))-1)

     

    I need to be able to make this work within the box itself.  I can not go behind the scenes and change the code there.  My team that I work with only makes changes to the text boxes and never messes with the code behind the scenes.

     

     

    Thanks

    Monday, October 13, 2008 6:33 PM

Answers

  • It is possible that you get this error because of division by zero. IIF is a function call which should evaluate all arguments before it executes.

    In your case you probably can simply update the formula using this idea =IIF(A=0,0,B/IIF(A=0,1,A))

     

    If i didn't miss anything, your formula will look like this :


    =IIf(Fields!n_forecasted.Value = 0 or Fields!answered.Value = 0 or Fields!handlesecs.Value = 0 or Fields!f_handlesecs.Value = 0, 0, (Fields!handlesecs.Value * Fields!n_forecasted.Value / IIf (Fields!answered.Value = 0 or Fields!f_handlesecs.Value = 0, 1, Fields!answered.Value * Fields!f_handlesecs.Value) -1))

     

    Hope that helps...

    Monday, October 13, 2008 8:36 PM
    Answerer

All replies

  • It is possible that you get this error because of division by zero. IIF is a function call which should evaluate all arguments before it executes.

    In your case you probably can simply update the formula using this idea =IIF(A=0,0,B/IIF(A=0,1,A))

     

    If i didn't miss anything, your formula will look like this :


    =IIf(Fields!n_forecasted.Value = 0 or Fields!answered.Value = 0 or Fields!handlesecs.Value = 0 or Fields!f_handlesecs.Value = 0, 0, (Fields!handlesecs.Value * Fields!n_forecasted.Value / IIf (Fields!answered.Value = 0 or Fields!f_handlesecs.Value = 0, 1, Fields!answered.Value * Fields!f_handlesecs.Value) -1))

     

    Hope that helps...

    Monday, October 13, 2008 8:36 PM
    Answerer
  • Thanks that fixed the error.

     

    Thank you

     

    Tuesday, October 14, 2008 8:41 PM