Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,

I'm looking to concatenate results in a SQL report into a single line of text.

I have a table of data:
==================
Description | Path
==================
test1       | C:\test.pdf
test2       | C:\test2.pdf


What I'm after in a SSRS report is a list of these with hyperlinks to the Path.

In other words the output should be:
test1, test2

(with a hyperlink on test1 and test2 pointing to the files).

So far i have been able to use a placeholder in a table cell in order to build the html hyperlink.
="<a href="""& Fields!Path.Value & """>" & Fields!Description.Value & "</a>"

Currently this lists two table rows with the hyperlinks correctly in place.

What I'm needing to do is list out the results as a single string with commas between. I have tried wrapping a join() round the existing expression but this produces an error.

I presume the placeholder needs to be removed from the table, as a table or tablix by its nature will repeat a row per result in the dataset.

I have tried adding a text box and placeholder directly on the report surface but this seems to generate an error when i use the above expression.

Any help greatly recieved.

Thanks,

Alex
Posted

1 solution

I have run into a similar problem many times before, so I created a custom SQL aggregate function to solve it. Let me know if you find this article helpful.

Concatenating Strings with a Custom SQL Aggregate Function[^]
 
Share this answer
 
Comments
Alex Lush 19-Nov-15 6:53am    
Thanks so much for this Daniel. Was exactly what i was looking for. Works really well!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900