Reporting Services - 根据参数动态设置字段值 [英] Reporting Services - setting a field value dynamically based on parameter
问题描述
我需要构建一个报告,以四个分组级别显示数据.棘手的部分是:要在这四个级别上显示的实际字段将作为参数传递到报表中.
I need to build a report that shows data in four grouped levels. The tricky part is: the actual fields to be displayed on those four levels are to be passed into the report as parameters.
我现在的主要问题是:如何告诉报告上的文本框不显示参数@X 的值,而是通过参数@X 中指定的名称显示字段的值?
My main issue right now is this: how can I tell a textbox on the report to not display the value of the parameter @X, but the value of the field by the name which is specified in parameter @X?
所以如果我传入@X = 'Agent'
,我不想在报告上显示'Agent',但真的
So if I pass in @X = 'Agent'
, I don't want to show 'Agent' on the report, but really
=Fields!Agent
但是我该怎么做呢?在我看来,这些值表达式几乎都是硬编码的 - 有没有办法定义
but how can I do that? It seems to me that those value expressions are all pretty much hardcoded - is there a way to define
=Fields!(@X)
或类似的东西 - 显示与参数 @X 中传递给报告的名称相对应的字段?
or something like that - show the field which corresponds to the name passed to the report in parameter @X ?
这可能绝对是愚蠢的 - 但我现在正在碰壁,似乎无法找到解决方法......
This is probably absolutely silly - but I'm hitting a brickwall right now and can't seem to find a way around it....
推荐答案
It is
=Fields(Parameters!X.Value).Value
指定此处
编辑为正确:我忘记了一旦您使用 =(表达式),您就必须以不同的方式处理参数.
Edited to be correct: I forgot once you use an = (expression) you have to address the parameter differently.
这篇关于Reporting Services - 根据参数动态设置字段值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!