Page 1 of 2

Click Event for sub report

Posted: Mon Mar 03, 2008 9:13 pm
by ymc
I have some requests from client about:

1. They want to display some data in the form of bar chart and during double click on the specific bar then display the detail. My idea is about can I just have a double click event and then rendering another report or enable the pre-rendered page to display? Any idea which method is possible to get the result.

2. The request is nearly the same as above but this time is click on the row and pass the value to render another report base on the clicked row data?

Thx.

Click Event for sub report

Posted: Tue Mar 04, 2008 7:20 am
by Vital
Hello,
1. They want to display some data in the form of bar chart and during double click on the specific bar then display the detail. My idea is about can I just have a double click event and then rendering another report or enable the pre-rendered page to display? Any idea which method is possible to get the result.
At this moment this is not possible.
2. The request is nearly the same as above but this time is click on the row and pass the value to render another report base on the clicked row data?
Yes, it possible. Please see sample project LiveReports from standard delivery.

Thank you.

Click Event for sub report

Posted: Sun Jun 22, 2008 5:20 am
by mihiri
Would you please explain how case 2 is done, this example is not clear to me..
Thank you in advance

Click Event for sub report

Posted: Mon Jun 23, 2008 6:19 am
by Vital
Hello,
mihiri wrote:Would you please explain how case 2 is done, this example is not clear to me..
Thank you in advance
Each component in report have filled Bookmark property (or Tag property). This value used as parameters for detail reports. Before report running we have signed to Click event of
report:

Code: Select all

report.CompiledReport.Click += new EventHandler(click);
In event handler of this event we use following code:

Code: Select all

private void click(object sender, EventArgs e)
		{
                        //Component which generate click event
			StiComponent comp = sender as StiComponent;
                        //Our parameter
			string customerID = (string)comp.BookmarkValue;
            
                        //Run report with parameter
			if (customerID != null)
			{
				StiReport report = new StiReport();
				report.RegData(dataSet1);
				report.Load("..\\..\\Details.mrt");
				StiDataBand dataBand = (StiDataBand)report.Pages["Page1"].Components["DataBand1"];
                                //Parameter assigned to databand filter
				dataBand.Filter.Value = "{Orders.CustomerID==\"" + customerID + "\"}";
				report.Show();
			}
		} 
Thank you.

Click Event for sub report

Posted: Tue Jun 24, 2008 11:47 pm
by mihiri
thanks a lot for your detailed description. But this code is not available in the
"C:\Program Files\Stimulsoft Reports.Net 2007.3\.Net 2.0\Samples\C#\LiveReports\LiveReports.mrt"
am I browsing the wrong place?

Click Event for sub report

Posted: Thu Jun 26, 2008 6:21 am
by Vital
Hello,

Please see code of Form1.cs.

Thank you.

Click Event for sub report

Posted: Wed Nov 26, 2008 2:04 am
by Pio Leonardo V. Rapirap
Had a look at this code:

Code: Select all

private void click(object sender, EventArgs e)
        {
                        //Component which generate click event
            StiComponent comp = sender as StiComponent;
                        //Our parameter
            string customerID = (string)comp.BookmarkValue;
           
                        //Run report with parameter
            if (customerID != null)
            {
                StiReport report = new StiReport();
                report.RegData(dataSet1);
                report.Load("..\\..\\Details.mrt");
                StiDataBand dataBand = (StiDataBand)report.Pages["Page1"].Components["DataBand1"];
                                //Parameter assigned to databand filter
                dataBand.Filter.Value = "{Orders.CustomerID==\"" + customerID + "\"}";
                report.Show();
            }
        } 
tried it, and successfully duplicated this one.


Hi! just a quick question.

how would it work if instead of loading an mrt file,
we load a compiled report instead

Code: Select all

report = StiReport.GetReportFromAssembly("Detail.dll");
is Filtering a databand value same as

Code: Select all

dataBand.Filter.Value = "{Orders.CustomerID==\"" + customerID + "\"}"; 
I tried this statement (although I know it wouldn't work)

Code: Select all

		StiDataBand dataBand = report.CompiledReport.GetComponents()["DatadsProject"] as StiDataBand;
		dataBand.Filter.Value = "{dsProject.busent== " + strBusEnt + "}";
it's obviously incorrect and honestly I don't have any idea how to do it :pffft:

Any Thoughts?!
Is it possible to create a parameter inside the Detail.mrt
and pass a value from it?

Are parameters accessible inside a compiled report? (dll) :byebye:


Click Event for sub report

Posted: Wed Nov 26, 2008 5:18 am
by Edward
Hello.
PLR wrote:how would it work if instead of loading an mrt file,
we load a compiled report instead
In that case the filter could be created with help of variables. This variables can be set before rendering and filters will work as expected.

Please make the following steps:

- Create MyVariable variable in the Dictionary.

- Set the Filter asexpression in the Designer as following:

Code: Select all

Orders.CustomerID==MyVariable
- before calling Render() or Show() command, assign the variable in the compiled report:

Code: Select all

myCompiledReport["MyVarialbe"] = 5;
Thank you.

Click Event for sub report

Posted: Thu Nov 27, 2008 9:29 pm
by Pio Leonardo V. Rapirap
Edward wrote:Hello.
PLR wrote:how would it work if instead of loading an mrt file,
we load a compiled report instead
In that case the filter could be created with help of variables. This variables can be set before rendering and filters will work as expected.

Please make the following steps:

- Create MyVariable variable in the Dictionary.

- Set the Filter asexpression in the Designer as following:

Code: Select all

Orders.CustomerID==MyVariable
- before calling Render() or Show() command, assign the variable in the compiled report:

Code: Select all

myCompiledReport["MyVarialbe"] = 5;
Thank you.
Worked like a charm!
:blush: Great Thanks Edward!

Click Event for sub report

Posted: Fri Nov 28, 2008 11:43 am
by Edward
Hello

Please let us know if any help is required.

Thank you.