none
SSRS Switch Function error

    Question

  • Hi I am having issue with switch function is ssrs
    I have declared a parameter in the report not in the proc
    Reportparameter:Sysage,catage,CustomerAge(3 different options to pick at the drop down list)

    for the graph i am using two differnt lines but at the category Groups i am using switch function
    =Switch("catage Age" = Parameters!ReportParameter1.Value,Fields!catage.Value
    ,"System Age" =Parameters!ReportParameter1.Value,Fields!SystemAge.Value
    ,"Customer Age" =Parameters!ReportParameter1.Value,Fields!AccountAge.Value)
    It is not picking right drop down list
    But instead of Switch Function, if i pick one age like 'catage' it does show the right data

    But switch is not picking correctly.

    Suggest me how am i doing it wrong.

    Thanks in advance

    Tuesday, November 19, 2013 8:32 PM

Answers

All replies

  • A parameter has both a value and a label. I suspect you are mixing them up. I think your parameter may have the following:

    Label                Value
    System Age      Sysage
    Catage Age      Catage
    Customer Age  CustomerAge

    If this (or something similar) is true then your switch should be comparing the parameter value to Sysage, Catage, and CustomerAge rather than System Age, Catage Age, and Customer Age. The spaces and capitalization matter.


    "You will find a fortune, though it will not be the one you seek." - Blind Seer, O Brother Where Art Thou
    Please Mark posts as answers or helpful so that others may find the fortune they seek.

    Tuesday, November 19, 2013 9:50 PM
  • Try this:

    =SWITCH
    (
    Parameters!ReportParameter1.Value = "catage Age", Fields!catage.Value,
    Parameters!ReportParameter1.Value = "System Age", Fields!SystemAge.Value,
    Parameters!ReportParameter1.Value = "Customer Age", Fields!AccountAge.Value
    )

    Tuesday, November 19, 2013 9:52 PM
  • The first 'Catage Age ' is picking right, but if i pick System Age CustomerAge the graph is all scroblled with thousdand ugly lines. THis seems to be ni helpful.

    Appreciate your quick response.

    Label                Value
    Catage Age      Catage Age 
    System Age     System Age
    Customer Age  CustomerAge

    =Switch

    (

    Parameters!ReportParameter1.Value="Catage Age", Fields!CAge.Value,

    Parameters!ReportParameter1.Value="System Age", Fields!Sge.Value,

    Parameters!ReportParameter1.Value ="Customer Age", Fields!AAge.Value

    )

    Wednesday, November 20, 2013 5:55 PM
  • I fixed it. I deleted the parameter and created again, and approched with Gary way, it workd

    Thanks a lot for quick response

    Thursday, November 21, 2013 8:58 PM