Reporting Services - setting a field value dynamically based on a parameter

I need to create a report that displays data at four grouped levels. The hard part: the actual fields that will be displayed on these four levels must be reported as parameters.

My main problem right now is this: how can I specify a text field in the report so as not to display the value of the @X parameter, but the value of the field by the name specified in the @X parameter?

So, if I pass @X = 'Agent', I do not want to show "Agent" in the report, but really

=Fields!Agent

but how can i do this? It seems to me that these value expressions are very hardcoded - is there a way to determine

=Fields!(@X) 

or something like that - display the field corresponding to the name passed to the report in the @X parameter?

This is probably absolutely stupid, but I'm on a brick wall right now and can't find a way around this.

+5
source share
2 answers

it

=Fields(Parameters!X.Value).Value

as indicated here

Edited as correct: I forgot, as soon as you use the expression = (expression), you will have to access the parameter in different ways.

+3
source

, , 1-4 , first?

=First(Fields!Param1.Value, "Param_Lookups")
0

All Articles