在 SQL Reporting Services 中,如何根据参数过滤数据集? [英] In SQL Reporting Services, how to filter a dataset according to a parameter?

查看:45
本文介绍了在 SQL Reporting Services 中,如何根据参数过滤数据集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个未经过滤的数据集要处理以生成报告(SQL Server 2005 btw).

I've got an unfiltered dataset to deal with so as to generate a report (SQL Server 2005 btw).

假设我有一个 Name 列,我想在我的报告中添加一个参数,以便仅选择包含某些字符的名称.

Let's say I've got a Name column, and I'd want to add a parameter to my report, so as to select only the names containing some characters.

有人知道如何处理这些过滤器吗?

Does one know how to deal with these filters?

我试过这些都没有运气:

I've tried with no luck these:

=Fields!Name.Value Like =Parameters!FilterName.Value

=Fields!Name.Value = = "%" + Parameters!FilterName.Value + "%"

如果我给参数 'oo',我希望能够获得名称 'foo' 和 'foobar'

I'd like to be able to get the names 'foo' and 'foobar', if I give the parameter 'oo'

我知道过滤应该在 SQL 服务器端完成,但我不控制我提供的数据集(网络服务给它一个无参数的方法),所以我必须在报表端过滤.

推荐答案

我自己回答的问题,过滤表达式其实是:

I answer to my own question, the filter expression is in fact:

=Fields!Name.Value Like ="*"+ Parameters!FilterName.Value + "*"

即事实上,使用 "*" 而不是 "%".

i.e. use "*" instead of "%", in fact.

这篇关于在 SQL Reporting Services 中,如何根据参数过滤数据集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆