Showing posts with label parameters. Show all posts
Showing posts with label parameters. Show all posts

Monday, March 26, 2012

forcing report to refresh

I have a RS report that I am integrating in to an ASP web site. I have
a menu page that gathers some user parameters (report dates etc) and
then opens the report in a new browser window, passing the user
parameters as querystring variables. I have noticed that the report
does not refresh if you use the same parameters twice in a row. For
example, I opened the report, tweaked the underlying data then ran it
again with the exact same parameters. The report did not channge. It
did change when I hit the refresh button in the report itself though. I
would prefer if my users did not have to perform this additional step.
Is there a parameter I can pass, or some other way to force this to
refresh every time?I never found a parameter that RS recognizes to automatically refresh
the report. What I ended up doing was to make up my own. Basically, I
pass all the parameters the report takes, plus another querystring
variable I called "GenDate", which contains the current date and time.
Than way the report parameters are always different, so the report
always refreshes. The problem with this is that RS does not like to
receive any parameters that it is not expecting, so I have to add this
parameter to every report. I just add it as a report parameter, but
don't associate it with anything in the recordset.
If anyone knows of a parameter the RS will recognize, please let me
know. For that matter, is there a master list somewhere? I have a few
that RS tacks on automatically (rs:Command=Render, rs:Format=HTML4.0,
rc:Toolbar=True, rc:JavaScript=True, rc:LinkTarget=_top,
rc:Area=Report), but the documentation is rather sparse.|||I finally came across rs:ClearSession=True which appears to accomplish
what I'm after.sql

Wednesday, March 21, 2012

Force prompt when using default parameters

I wrote an sp and assigned static values to fields for easy testing, after
that I created the parameters and assigned default values to them, now
everytime I click preview I don't get a prompt for new values, the report
automatically runs with the defaults.
I want to be able to use the default values most of the time but also want
the option to change them if needed. The only option is to stop the report
and enter different values. This is strange because I have other reports that
have all default values but give me a prompt in preview.Someone answered this a few ones back.
Add a boolean "Run Report" parameter to the report with no default.
-T
"Ash_Cat" <AshCat@.discussions.microsoft.com> wrote in message
news:3974BD37-7DCD-4FBF-8602-F660A7ADE92C@.microsoft.com...
>I wrote an sp and assigned static values to fields for easy testing, after
> that I created the parameters and assigned default values to them, now
> everytime I click preview I don't get a prompt for new values, the report
> automatically runs with the defaults.
> I want to be able to use the default values most of the time but also want
> the option to change them if needed. The only option is to stop the report
> and enter different values. This is strange because I have other reports
> that
> have all default values but give me a prompt in preview.|||Cool! Thx Tim
"Tim Dot NoSpam" wrote:
> Someone answered this a few ones back.
> Add a boolean "Run Report" parameter to the report with no default.
> -T
> "Ash_Cat" <AshCat@.discussions.microsoft.com> wrote in message
> news:3974BD37-7DCD-4FBF-8602-F660A7ADE92C@.microsoft.com...
> >I wrote an sp and assigned static values to fields for easy testing, after
> > that I created the parameters and assigned default values to them, now
> > everytime I click preview I don't get a prompt for new values, the report
> > automatically runs with the defaults.
> > I want to be able to use the default values most of the time but also want
> > the option to change them if needed. The only option is to stop the report
> > and enter different values. This is strange because I have other reports
> > that
> > have all default values but give me a prompt in preview.
>
>

Monday, March 19, 2012

Force at least one parameter (2K5)

I am trying to build a report that has about 6 different parameters. All of the parameters have been set to allow null, however, I would like the user to put in at least one "search" criteria in order to run the report.

How would I be able to do that?

In addition, when I am viewing the report, it automatically runs and does not wait until I click "View Report". How can I set it not to execute when the report is viewed, but when the user clicks the button?

ThanksHow about setting one of the parameters to not allow blank but setting the default to blank? Might solve both problems in one go, at least forcing the user to think about what they enter... Haven't tested it though |||

The program will not allow you to set a blank default value with the "Allow Blank Value" checked.

Thanks for trying ;)

|||

DotNetSavvy,

Unfortunate if all of your parameter have null values and nulls are allow, then your report will automatically run. I personally set default to all my parameters but one.

On the forcing a parameter selection, you could raise an return error from SQL if all parameters are null.

hammer

|||

Solution:

Create embedded code function that takes as parameters your report parameters values (like this MyFunction(p1value, p2value, p3value,...) ) Inside do something like this: iff(IsNothing(p1value)=true,0,1)+iff(IsNothing(p2value)=true,0,1)+... and if the result is < 1 then throw error/message box with some text (like: "Please assign at least one parameter value") and return null else return 1 or other not null value.

Add internal parameter that cannot be null to your report and in the "expression" of the default value use your code function: =Code.MyFunction(p1.value, p2.value, ...).

Here is an example of using function and parameter to validate report execution http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=829175&SiteID=1

Should work.

Maciej