简体   繁体   English

SSRS-多值参数

[英]SSRS - multi-value parameter

I've got a relatively huge table with customer ID s and I'm trying to create an SSRS report where I would be able to pass in a multi-value string to my @CustomerID parameter. 我有一个带有customer ID的相对较大的表,并且试图创建一个SSRS报告,可以在其中将多值字符串传递给我的@CustomerID参数。

For example, two separate customer id's: 例如,两个单独的客户ID:

'1212121, 3242342' . '1212121, 3242342'

The question is whether there is any way to set up my parameter so that I can type in my CustomerID 's, instead of having to select from a huge drop down list with hundreds of CustomerID 's. 问题是是否有任何方法可以设置我的参数,以便我可以键入CustomerID ,而不必从包含数百个CustomerID的巨大下拉列表中进行选择。

You can type directly into a multi-value parameter. 可以直接输入多值参数。 To add more then one entry by hitting Shift+Enter after each entry. 要添加多个条目,请在每个条目后按Shift + Enter。 Each entry will appear on a separate line. 每个条目将显示在单独的行上。 There is no need to add commas. 无需添加逗号。

However this is not a great way of doing things as you are expecting users to know ids. 但是,这不是一种很好的处理方式,因为您希望用户知道ID。

What I normally do is use two parameters. 我通常要做的是使用两个参数。

The first parameter (called say @custSearch ) is a simple plain text parameter. 第一个参数(称为say @custSearch )是一个简单的纯文本参数。

The second parameter is populated from a dataset with a query something like this... 第二个参数是使用类似这样的查询从数据集中填充的...

SELECT CustomerID, CustomerName 
    FROM myCustomerTable
    WHERE Customername like '%' + @custSearch + '%'

So, the user types a partial match into the first parameter which filters the second one down to only matching customers. 因此,用户在第一个参数中输入部分匹配项,从而将第二个匹配项过滤为仅匹配的客户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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