How to split the data in ssrs

  • Hello,

    I have a textbox in the header where I am trying to split the field

    The column data in database looks like

    1185-Peachtree County

    But in my ssrs report I need only 1185 (I need to show header as Report System-1185 DATA)

    I written the expression as

    ="FNS Report System-" + VBCRLF + Fields!SystemName.Value+" "+"DATA"

    How to split it any help?

  • if the numeric portion is fixed length (always four characters), use the Left function e.g.

    Left("1234-abc", 4)

    yields "1234"

    If the numeric portion is variable length, add a call to InStr:

    =Left("1234-abc",InStr("1234-abc","-")-1)

  • I understood,but I am using column name as Systemname

    From system name I am getting values ad 1184-abc

    Now I want in ssrs report only 1184 how can I write the expression is there any function in ssrs

    I tried split but not working..

  • gbritton1 (5/1/2014)


    If the numeric portion is variable length, add a call to InStr:

    =Left("1234-abc",InStr("1234-abc","-")-1)

    That's your answer, just replace the hard-coded text with your Field name.

  • Neat way to do it is use the Val() function.

    This will return all the numbers on the left of a string until it hits a non-digit value.

    e.g. Val("12345-Parkway") returns 12345.

    Only gotchas are it returns 0 if there is no numeric part and something like "1 2 3-Parkway" would return 123.

    Remember to convert to a string if you are concatenating the value.

    i.e. Cstr(Val(Fields!systemname.value))

  • Thank You for the reply

    I have a question here -

    If I select parameter system as 'ALL' in the data base I have a system name column showing data as ALL Systems

    If I select parameter as 648

    In the database I have a data 648-County

    The one which you told me to use val is working fine for only 648 - County

    I used expression as =Cstr(val(fields!systemname.value))

    When I select ALL and I preview the report its showing as 0

    How to solve this issue

    I want to show this message in header

  • I'd probably just do something like the following:

    =Iif(Parameters!Systemname.Value = "ALL", Fields!Systemname.Value, Cstr(Val(Fields!Systemname.Value)))

  • I tried in this way

    =IIF((Parameters!SystemId.Value) = "ALL", "ALL Systems DATA",Parameters!SystemId.Value+" " +"DATA")

    It got worked;Thank you so much..

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply