简体   繁体   中英

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

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:

在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM