Wednesday, March 7, 2012

Hard Coded parameters

Is it possible to force parameters into the reports so enabling me to force a user id value into every report that is picked up from the list. The user ID is a system value and I don't want end users having any knowledge of it?

Cheers

Darren

Hello Darren,

What you can do is create a hidden/internal parameter so that the end user can not see it. From BOL:

Hidden

Select this option if the parameter value should not appear on the report. Although hidden parameters do not appear on a report, they can be set in other ways (for example, in subscriptions and through URLs).

Internal

Select this option if the parameter cannot be changed at run time. On a published report, no visual evidence is provided to indicate that this parameter exists.

Hope this helps.

Jarret

|||

Hi Jarret,

I think this may be the answer, I need to provide a list of published reports , how would we then get the hidden parameter into it.

Can we display a URL with the user ID already in it which will then render the report viewer with the other optional parameters to be picked. How do we stop somebody constructing a URL with a different user ID.

A hidden parameter sounds like the right option but I'm confused how to populate it.

Cheers, Darren

|||

If you're wanting to keep it out of the URL as well, you'll need to go with an Internal parameter, since it can not be changed at run time. Hidden parameters can be changed through the URL. You can change the value of this from within your Report Manager. Go to the properties of your report, then go into the Parameters section. In there, you can change the default value to whatever you like.

Hope this helps.

Jarret

|||Is the Internal parameter fixed in the report then? I want to be able to change the value based on the user running the report but do not want them to be able to change to a user ID not associated to them.|||

I'm not sure how you were planning to change the user ID of the user running the report, but you can set an expression for the default value of any parameter through VS.

If you put =User!UserID as the Default value for your parameter, it will show the domain account used.

Just remember, if you use a hidden parameter, someone can manipulate the value via the URL. This is not possible with an internal parameter.

Jarret

|||

Thanks Jarret,

I think I know what we will do know. The web site maintains a guid session token for each user which originates from the database initially so if I use this as my hidden parameter and let the reports stored procedure calculate the user ID based on this I will be safe.

Cheers

|||

That sounds like it would work, but someone can pass in that parameter via the URL since you're using a hidden parameter. The internal parameter should work in this situation too, and you don't have to worry about it being changed by a user.

Anyway, I'm glad you have a solution. Can you mark this one as answered so others can see the solution?

Jarret

No comments:

Post a Comment