none
Error in expression

    Question

  • Hi all,

    I have an expression as mentioned below.

    if code = val1 then

       if date1 >= parameter_start_date and date1 <= parameter_end_date then

          if flag = "D" then

             field!charge.value

         else

            0

       else

           0

    else

        if date2 >= parameter_start_date and date2 <= parameter_end_date then

          if flag = "D" then

             field!charge.value

         else

            0

       else

           0

    How to convert this crystal function into SSRS expression.I have tried to convert, but when the report is rendered, i am getting #Error as charge value in report. thanks in advance for any help.
    Wednesday, October 09, 2013 6:34 AM

All replies

  • Hi, 

    The best way to do this my opinion is to break each section down and test your expression with each section and then combine it.

    Try this

    =iif(code = val1 and date1>parameter_start_date and date1<parameter_end_date and flag = "D", field!charge.value,
    iif(date2>parameter_start_date and date2<parameter_end_date and flag = "D",  field!charge.value,0))

    Monday, December 09, 2013 5:00 PM
  • hi,

    i assume the "code", "date1", "date2", "flag" and "charge" fields come from dateset itself.

    use the following expression.

    hope it resolves your issue.

    =IIF( Fields!code.Value = "val1" , IIF( Fields!date1.Value>= Parameters!start_date.Value &  Fields!date2.Value <= Parameters!end_date.Value , IIF( Fields!flag.Value= "D",   Fields!charge.value, 0) , 0  ),  IIF(  Fields!date2.Value>= Parameters!start_date.Value &  Fields!date2.Value<= Parameters!end_date.Value, IIF( Fields!flag.Value= "D",   Fields!charge.value, 0)  , 0) )


    Touseef
    Find More SSRS Topics @ Blog: touseefsk/CrazyErrors

    Tuesday, December 10, 2013 1:09 PM