none
Need Help with SWITCH RRS feed

  • Question

  • Hello

    I have two values in my dataset, "T" and T2, I want to change the value in the text box but is not working.

    Please help

    Switch(Fields!a_TEST.Value = "T", "TEST1", Fields!a_TEST.Value  ="T2", "TEST2")

    Friday, July 5, 2019 2:36 PM

Answers

  • Wondering if there are some spaces at the end of the string since the data type is char. Try to use TRIM function:

    =IIF(TRIM(Fields!Testing.Value)= "T", "Test1", "Test2")


    A Fan of SSIS, SSRS and SSAS

    • Marked as answer by Pink89 Friday, July 5, 2019 9:06 PM
    Friday, July 5, 2019 8:44 PM

All replies

  • Hi,

    Try with this expression :

     Switch(Fields!a_TEST.Value = "T", "TEST1", Fields!a_TEST.Value  ="T2", "TEST2", TRUE,"")

    You have to add the else at the end in case the value different to T and T2


    Ousama EL HOR

    [If a post helps to resolve your issue, please click the "Mark as Answer"  of that post or click Answered "Vote as helpful"  button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]


     [User Page]     [MSDN Page]     [Blog]     [Linkedin]

    Friday, July 5, 2019 2:55 PM
  • Hello

    Is not working now the textbox is empty.

    Friday, July 5, 2019 3:31 PM
  • =IIF (Fields!a_TEST.Value = "T", "TEST1", "TEST2")


    A Fan of SSIS, SSRS and SSAS

    Friday, July 5, 2019 3:32 PM
  • HI 

    It didnt work

    " The Value expression for the textrun ‘a_test_unit.Paragraphs[0].TextRuns[0]’ contains an error: [BC30311] Value of type 'Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.Field' cannot be converted to 'String'

    The data type is char,


    • Edited by Pink89 Friday, July 5, 2019 4:15 PM
    Friday, July 5, 2019 4:15 PM
  • The field data type is not the string. you need to convert it to string

    A Fan of SSIS, SSRS and SSAS

    Friday, July 5, 2019 4:17 PM
  • Hello

    It didnt work either  all values are TEST2

    Friday, July 5, 2019 6:10 PM
  • Can you post your expression?

    A Fan of SSIS, SSRS and SSAS

    Friday, July 5, 2019 6:25 PM
  • Hi 

    I cast the field were I was receiving the error.  cast (test as varchar)

    here it is

    =IIF(Fields!Testing.Value= "T", "Test1", "Test2")

    I did something similar long time ago with switch but even using it with that works now...

    • Edited by Pink89 Friday, July 5, 2019 8:10 PM
    Friday, July 5, 2019 8:09 PM
  • Wondering if there are some spaces at the end of the string since the data type is char. Try to use TRIM function:

    =IIF(TRIM(Fields!Testing.Value)= "T", "Test1", "Test2")


    A Fan of SSIS, SSRS and SSAS

    • Marked as answer by Pink89 Friday, July 5, 2019 9:06 PM
    Friday, July 5, 2019 8:44 PM
  • Yes it work thank yo so much!!
    Friday, July 5, 2019 9:06 PM