简体   繁体   中英

How to populate multi value parameter based on another parameter in SSRS

I have parameter @Coverage and parameter @CoverageLosses . They are NOT parent and child. I want default values for @CoverageLosses populated with values, based on @Coverage . So my main dataset @Coverage looks like this:

SELECT DISTINCT Coverage
FROM            PlazaInsuranceWPDataSet
ORDER BY Coverage

My secondary dataset @CoverageLosses looks like this:

SELECT DISTINCT Coverage AS CoverageLosses
FROM            tblLossesPlazaCommercialAuto
WHERE Coverage IN (@Coverage)
ORDER BY CoverageLosses

In report parameter @CoverageLosses I checked Allow Multiple values then in default--> Specify values I am writing this expression:

=IIF(Parameters!Coverage.Value="Liability","AutoLiabilityCLS" ,nothing)

It works fine for single value. But I want to see multiple values for @CoverageLosses if I choose @Coverage = Liability

How can I write the expression for that? Something like that:

=IIF(Parameters!Coverage.Value="Liability","AutoLiabilityCLS" & "AutoLiabilityCLS" & "AutoBodilyInjuryLiability"  ,nothing)

@CoverageLosses used for another table in my report. It will be hidden. But values from @Coverage will be mapped to values @CoverageLosses. So when user select, lets say value1 from @Coverage then default values in @CoverageLosses should be value1, value2,value3 etc

在此处输入图片说明

you could create an additional dataset and use it as your source for parameter:

select CoverageLosses from  (
select 'Liability' Coverage ,'AutoLiabilityCLS' CoverageLosses union 
select 'Liability' Coverage ,'AutoLiabilityCLS' CoverageLosses union 
select 'Liability' Coverage ,'AutoBodilyInjuryLiability' CoverageLosses union
select null Coverage ,null CoverageLosses  ) x
where Coverage = @Coverage

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