Unexpected Behaviour When Using Request Parameters = True

Stimulsoft Reports.WEB discussion
Post Reply
james.crossley
Posts: 28
Joined: Sun Aug 07, 2011 8:53 pm
Location: Auckland

Unexpected Behaviour When Using Request Parameters = True

Post by james.crossley »

Hello

I've created a series reports using with the report parameter Request Parameters = True.

My users are prompted to select or enter Variables for the reports. The Variables are used in my SQL queries. This works as expected.

However, when debugging today, I noticed that when a report is loaded, the SQL query is executed BEFORE the Parameter/Variable panel is displayed.

This occurs in the Web Viewer and WebFx Viewer.

This produces an unnecessary trip to the database (query) and is undesirable because the user hasn't entered the parameters yet.

Is there a way I prevent the SQL query from occurring until the user enters variables and clicks the Submit button?

Thanks
James
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Unexpected Behaviour When Using Request Parameters = Tru

Post by HighAley »

Hello.

Please, try to set the Request Parameters property of the report to True. Then SQL queries will be executed after requesting of the parameters.

Thank you.
james.crossley
Posts: 28
Joined: Sun Aug 07, 2011 8:53 pm
Location: Auckland

Re: Unexpected Behaviour When Using Request Parameters = Tru

Post by james.crossley »

Hi Aleksey

I have checked the reports, the report Request Parameters property is set to True.

The SQL queries are being executed before the requesting of the panel.

The version I'm using is Web 2013.2.1612
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Unexpected Behaviour When Using Request Parameters = Tru

Post by HighAley »

Hello.

If you need to disable SQL queries, please, set the Connect On Start of every Data Source to false and then in the Begin Render event Connect them.

Thank you.
james.crossley
Posts: 28
Joined: Sun Aug 07, 2011 8:53 pm
Location: Auckland

Re: Unexpected Behaviour When Using Request Parameters = Tru

Post by james.crossley »

Hi Aleksey

Thanks.

The version I'm using is Web 2013.2.1612 (Web and FX Viewers)

I can see how to set the Connect On Start of every Data Source to false, OK.

Please explain how I should Connect on the Begin Render event. Do I need to add Databand BeginRender event code inside the report for each databand and add a handler?

e.g.

Code: Select all

public void DataBandNAME__BeginRender(object sender, System.EventArgs e)
{
   // what is the code to connect?
}

this.DataBandNAME.BeginRender += new System.EventHandler(this.DataBandNAME__BeginRender);

Thanks for your help
James
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Unexpected Behaviour When Using Request Parameters = Tru

Post by HighAley »

Hello.
james.crossley wrote:Please explain how I should Connect on the Begin Render event. Do I need to add Databand BeginRender event code inside the report for each databand and add a handler?
You should to connect every necessary Data Sources in the Begin Render event of the report with Connect() method of each data source. For example,

Code: Select all

YourDataSourceName.Connect();
Thank you.
james.crossley
Posts: 28
Joined: Sun Aug 07, 2011 8:53 pm
Location: Auckland

Re: Unexpected Behaviour When Using Request Parameters = Tru

Post by james.crossley »

Hi Aleksey

Please excuse my ignorance. I'm unable to make this work. So far I have added a BeginRender method after the generated code as detailed below. I don't understand how it is called within the report. Do I need to add code to raise the BeginRender event? I assumed it would be called automatically.

Code: Select all

               #endregion StiReport Designer generated code - do not modify

		public void BeginRender(object sender, System.EventArgs e)
		{
			this.circuits.Connect();
			this.contacts.Connect();
			this.customer.Connect();
			this.items.Connect();
			this.jobs.Connect();
			this.licensee.Connect();
			this.notes.Connect();
		}
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Unexpected Behaviour When Using Request Parameters = Tru

Post by HighAley »

Hello.

You should add the code on the Property Grid. Look at the attached image.
BeginRenderWeb.png
BeginRenderWeb.png (12.14 KiB) Viewed 3181 times
Thank you.
james.crossley
Posts: 28
Joined: Sun Aug 07, 2011 8:53 pm
Location: Auckland

Re: Unexpected Behaviour When Using Request Parameters = Tru

Post by james.crossley »

Hi Aleksey

The screen shot was just what I needed. I was looking in all the wrong places!!!

Thank you VERY much for the help.

Regards
James
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: Unexpected Behaviour When Using Request Parameters = Tru

Post by Andrew »

Hello,

We are always ready and glad to help you.

Thank you.
Post Reply