Join Multivalue Parameter Values Into a String and LTrim Whitespace
Hi In my reports i like to print the values of the paramters used to generate the report at the top of my reports. I've just written a report usuing MDX and one of the Parameters is a multivalue list based on a hierachy. The problem i have is when i join the parameter label values together it's bringing through the indenting preceeding whitespace. I've been struggling for a while now to try and trim this off Anyone have any suggestions?? =JOIN(Parameters.Sites.Label,", ") results in Head Office, Branch 1, Subbranch 1 etc If i put =JOIN(LTrim(Parameters.Sites.Label),", ") i get the error Overload resolution failed because no accessible 'Join' can be called with these arguments cheers Matt
October 22nd, 2010 11:50am

After a bit more searching it was clear that it wasn't going to be possible to do it directly with the Functions from the expression editor so instead i used some custom code as described in this post http://www.sqlservercentral.com/Forums/Topic647539-147-1.aspx Public Function JoinTrim(myArray as object) As String Dim ReturnString as string, Item as string, FirstItem as boolean = true For each Item in myArray If FirstItem = True ReturnString = Trim(item) Else ReturnString = ReturnString + ", " + Trim(item) End If FirstItem = False Next item Return ReturnString End Function you could obvioulsy modify it slightly by adding an additional input paramter so that you can specify the delimiter where as this one is just hard coded to be ", "
Free Windows Admin Tool Kit Click here and download it now
October 22nd, 2010 1:08pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics