Search code examples
reporting-servicesssrs-2008

SSRS using parameters in expresions - error bc30205 End of statement expected


I'm tring to get the DData value and using as a parameter in the query, but i'm getting error "BC 30205 End of statement expected"

The user is going to chosse a value between -6 and 0 using the parameter DData after processing the value from DData I was trying to set the result in another parameter (RemoveDays - the one I'll be using in the query) but I don't know what am I doing wrong

and this code should ignore the weekends and set the result in the RemoveDays

--weekday = 1 = sunday

--weekday = 7 = saturday

=switch(
        Weekday(DateAdd("d", Parameters!DData.Value, Today())) = 1, Parameters!DData.Value+2,
        Weekday(DateAdd("d", Parameters!DData.Value, Today())) = 7, Parameters!DData.Value+1,
        Weekday(DateAdd("d", Parameters!DData.Value, Today())) <> 7 and Weekday(DateAdd("d",Parameters!DData.Value,Today())) <> 1, Parameters!DData.Value
       )

Solution

  • Your question is difficult to understand, however you might want to try the following.

    =SWITCH(
            Weekday(DateAdd("d", Parameters!DData.Value, Today())) = 1, Parameters!DData.Value+2,
            Weekday(DateAdd("d", Parameters!DData.Value, Today())) = 7, Parameters!DData.Value+1,
            True, Parameters!DData.Value
           )
    

    All I have done is replace your final test with True. This acts like an ELSE in SWITCH()

    If this does not help, please add a few samples of parameter values and the expected output.