Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

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?

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) 

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....

like image 831
marc_s Avatar asked Dec 15 '09 07:12

marc_s


1 Answers

It is

=Fields(Parameters!X.Value).Value

as specified here

Edited to be correct: I forgot once you use an = (expression) you have to address the parameter differently.

like image 183
jimconstable Avatar answered Nov 14 '22 23:11

jimconstable