Concatenate distinct row values for field in reporting services

…衆ロ難τιáo~ 提交于 2019-12-19 10:52:31

问题


I have a report in reporting services and I want to concatenate all the distinct values of a column separating by commas and place the value in a textbox. I know I could do it in the SQL using one of the answers here. But I'd rather not change the sql and just do it in the report if possible.

Example: I've got a dataset with several fields, one of which is category. Say the values are "Phone", "Service", "Phone", "Accessory", "Case", "Case". I want the textbox in my report to end up with the value "Accessory, Case, Phone".

In case it makes a difference, it is SSRS 2008 R2.


回答1:


I've figured out a way, although not the most elegant solution. I've added an internal parameter to get the list of all possible categories as well as an additional parameter to get rid of the duplicates. I've followed the steps here (starting at the part where they are adding dummy parameters) to do the above.

Essentially,

  1. Create a mulit-value parameter using the dataset and field I want for available/selected values. Be sure to mark as internal on the General tab.
  2. Add the RemoveDuplicates function shown in the link to the Code tab in Report Properties
  3. Create a second multi-value parameter that uses the RemoveDuplicates function. Similarly, be sure to mark as internal.

After that I used the Join function on the second parameter to create the comma delimited list.



来源:https://stackoverflow.com/questions/14046186/concatenate-distinct-row-values-for-field-in-reporting-services

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!