How to get parameter name and values dynamically in SSRS 2008
Hi,
I have 5 parameters in a report, let us take param1, param2, param3, param4, param5.
In textbox i want to display parameters format like below
param1.name=param1.value
param2.name=param2.value
i know how to display using expressions in ssrs 2008, but client wants to display all parameters and its value dynamically using customcode
If we place that customcode function in textbox like code.customfn(parameters) it should generate parameters and its value like i mentioned in the above format.
Any help is appreciated
sabburudra
June 16th, 2011 6:54am
Hi sabburudra,
To this requirement of yours, you can drag one textbox on your report body, in the textbox, just type in the expression like this: =Parameters!param1.Label & "=" & Parameters!param1.value & vbCrLf & Parameters!param2.Label & "=" &
Parameters!param2.value & vbCrLf & Parameters!param3.Label & "=" & Parameters!param3.value & vbCrLf & Parameters!param4.Label & "=" & Parameters!param4.value & vbCrLf & Parameters!param5.Label & "=" & Parameters!param5.value
Then you will get the format you mentioned.
If I misunderstand you, please feel free to let us know.
Thanks,
Challen Fu
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Free Windows Admin Tool Kit Click here and download it now
June 20th, 2011 6:13pm
Hi sabburudra,
To this requirement of yours, you can drag one textbox on your report body, in the textbox, just type in the expression like this: =Parameters!param1.Label & "=" & Parameters!param1.value & vbCrLf & Parameters!param2.Label & "=" &
Parameters!param2.value & vbCrLf & Parameters!param3.Label & "=" & Parameters!param3.value & vbCrLf & Parameters!param4.Label & "=" & Parameters!param4.value & vbCrLf & Parameters!param5.Label & "=" & Parameters!param5.value
Then you will get the format you mentioned.
If I misunderstand you, please feel free to let us know.
Thanks,
Challen Fu
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
June 20th, 2011 6:13pm
Hi Challen Fu,
Thanks for the response.
But i want it in customcode only, for example if i have hundreds of reports and each report has more than 20 parameters.
At that time if i write custom code and place code.customfn(parameters) in textbox, it should dynamically generate format.
sabburudra
Free Windows Admin Tool Kit Click here and download it now
June 23rd, 2011 7:57am
Hi sabburudra,
Your requirement is reasonable, however different report of yours contain different number of parameter, you need to create a function to receive dynamical number of parameter, if you define the max number of parameter in the function, you
should also consider passing the null value for this parameter, which are not contained in a certain report, which is also conplicated, what do you think of? if we can pass a dynamical number of parameter to this function, which might solve
this issue effectively. My first replt is just a workaround, I still hope somebody could give a grace solution.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
June 27th, 2011 6:16am
Hope this link helps
http://www.osix.net/modules/article/index.php?id=828
You have to modify this code to loop through the list of parameters and their values.
Good luck !!!
Free Windows Admin Tool Kit Click here and download it now
June 27th, 2011 3:40pm
Hi Sorna Kumar Muthuraj,
according to the above suggested website, we have to pass parameters to customcode like
=YourDll.DisplayParams(Parameters, "Param1, Param2");
but i want a custom code like we should n't pass parameters like
=YourDll.DisplayParams();
it should generate all parameters and its values dynamically.
sabburudra
July 8th, 2011 6:45am
“You cannot use a Microsoft Visual Basic
For Each construct to step through the collection. You need to know the name of a parameter defined in a report definition before you can reference it in your code.”
http://blogs.msdn.com/b/jenss/archive/2008/04/30/enumerating-parameter-collection-in-sql-server-reporting-services.aspx
You will not be able to loop through the Parameters collection.
Alternatively you can try get the parameters list from the Reportserver database and loop through it to get the values of the parameters.
Free Windows Admin Tool Kit Click here and download it now
July 8th, 2011 7:06am