Showing posts with label reporting services split. Show all posts
Showing posts with label reporting services split. Show all posts

Wednesday, December 1, 2010

SSRS Split method to get the last element of the split array

One of the report columns had the entire folder path, but all I wanted to show was the innermost folder name and exclude all the parent folders.
For example, from the path C:\Dropboxes\DeviceType\LogFiles\DeviceName\Tuesday\ the report should just show "Tuesday".

Split function is the first thing that comes to mind and that's what I saw in SSRS list of expression methods and used.
=Split(Fields!FolderPath.Value.ToString(),"\",-1)(Split(Fields!FolderPath.Value.ToString(),"\",-1).GetUpperBound(0)-1)

The second split is to get the count of total elements as I need to find the last element of the split array, and the folder path depth is not static.