SSRS - Sending multiple ID values in a parameter and generating a tablix row for each value in parameter

こ雲淡風輕ζ 提交于 2019-12-24 15:42:10

问题


UPDATE: Solution at bottom of post!

I have a report in SSRS that receives one parameter @ID and then generates the report. My task is to find out if it's somehow possible to pass multiple ID values at once inside one parameter and then generate a report for each of those values and place them all inside one PDF file. However, I want to know if it's possible to somehow pass a parameter that contains multiple number values (IDs) which would look like this, for ex. : @ID=1,2,3,4,5.

I would then place my report inside a tablix row or something like that and generate a row for each of those values I pass in parameter. In the end, I would have multiple "reports" generated inside one PDF.

Is something like this even possible to do in SSRS? Report is generated through a link sent to the report server and the link would include all IDs, preferably.

UPDATE WITH SOLUTION:

Came up with solution that works with passing multiple parameters. I've changed my query from this:

DECLARE @Sem_ID AS VARCHAR(MAX) = '137210;137211'

SELECT Sem_ID, Sem_KW, Sem_Jahr
FROM acc_seminar.t_Seminar
JOIN dbo.tbl_hotel h ON Sem_Ht_ID=h.pk_hotel
WHERE Sem_ID IN (SELECT value  
FROM fn_Split(@Sem_ID, ';')  
WHERE RTRIM(value) <> '')

As you can see, I changed 'WHERE' clause to split @Sem_ID parameter to get int values where the delimiter is ' ; ' . After that, I can input multiple values in single parameter like this:


回答1:


In your Report go to your Parameter, Select Multiple Value Check box. When you preview your report it will show you an option of drop down list.

Here you will find very good working example of your desired functionality



来源:https://stackoverflow.com/questions/55586743/ssrs-sending-multiple-id-values-in-a-parameter-and-generating-a-tablix-row-for

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