SQLTeam.com | Weblogs | Forums

Ssrs 2008 using a substring


In an ssrs 2008 report, I would like to select on only part of a value that displays on the report heading. I have tried to use the mid function so far, but I have not been able to select the correct part of the string I want to see.

An example of a value is 'Grace Elementary - 066 15-16 Grace Elem' and I want the value to look like

'066 15-16 Grace Elem' . Thus would you show me how to change the display value to be '066 15-16 Grace Elem'?


How you would do it depends on what the rules are. To use MID, assuming that the original text is in TextBox1, you would do something like this:


More likely than not, that 19 that I have hard-coded there is not applicable in every case. That is where the rule that I referred to earlier comes into play. What is the rule that determines the starting character that you want to pick up?


The school value could also look like ' King Potter (7-8) - 894 15-16 King Potter Tech'. The value I want from this string is '894 15-16 King Potter Tech'.

The best way to obtain the needed value is to start from the right side and look for '-' before the 894.

How would you obtain the this value and the previous one that I listed above?