• dabello88 (7/28/2014)


    What up Guys,

    First time posting a question here. I'm not entirely sure how to solve. I have the following string I need to parse in SSRS so that it looks like the below. the string can change to have more or less values but the pattern will be the same. I have tried using the split function, but I can only get it to return one value

    What I Tried so far

    =Fields!Tix_Price.Value.ToString().Split("==")(0) but this only returns one value.

    I've also tried directly in SP with the charindex function but I get the same results. Can't get it to display just "Child, Adult"

    String: CHILD=1625=0n=1==3&ADULT=1900=1j=1==1

    What it should look like: CHILD, ADULT

    Any help would be appreciated.

    A field in SSRS, or text box, contains a single value. The split function creates an array, and it looks like you are just returning the first value of the array (0) because the array is zero indexed. You are also splitting on the double equals sign "==" which I am guessing returns this whole nasty thing "CHILD=1625=0n=1".

    Try splitting on a single equals. You would then want the zero'th and fifth item in the array, and you want to throw in a comma it seems as well.

    Sorry not at a workstation with ssrs right now but assuming your syntax above is right it might be something like:

    =Fields!Tix_Price.Value.ToString().Split("==")(0) + "," + Fields!Tix_Price.Value.ToString().Split("==")(5)

    Is plus the concatenation operator? I'll have to double check in the morning. You might also want to split that second string again by the & ampersand and take the second (1) item.

    You might want to take a Google at Split Join as well, which is common syntax for splitting into an array, then joining the array elements back together with a delimited, often a comma as you've indicated you want.