Page 1 of 1

Get current datasource object.

Posted: Mon Jan 21, 2008 7:44 pm
by rbautistaole
Hi.
I'm evaluating StimulReports.
I need a master-detail report using BusinessObjects (XPCollection from DevExpress) as DataSource.
I place a Stimulreport Component in a form and two XPCollection component and add this collections to Stimul repot DataSource. The type of objects in collections are Type of collection1 = master, type of collection2 = detail.
I do not have relation betwen collections.
I place two dataBands into report and set DataBand1.DataSource = XPCollection1, DataBand2.DataSource = XPCollection2. I make this for give to the end user the possibility to change the layout from the report.
In run time print I want to provide the DataSource for DataBand2 in the DataBand2.BeforePrint event for each object printed for DataBand1 , for this I think that i must write the code as:
(pseudocode)
1.- Get the object (type master) currently being printed in DataBand1.
2.- Call a method for Get a detail collection for object master.
3.- Set the DataBand2.DataSource = collection getted in step 2. (Regdata()?)
Can you say to me if StimulReport can run this way to print and how?
thanks and excuse my bad english.

Get current datasource object.

Posted: Tue Jan 22, 2008 7:26 am
by Edward
The goal you are writing about can be achieved even in more simple way. As the Business objects are transformed to DataSet per each separated Connection to the data inside the report's Dictionary, then you can create a master-detail connection inside the report even between DataSets which are situated in different Connections. For this feature Report.CacheAllData must be set in true. It can be done in the Designer as well.

After that please follow the tutorial about creating of the Master-Detail reports:

http://www.stimulsoft.com/livedemos/Rep ... eport.html
http://www.stimulsoft.com/livedemos/Rep ... ort_2.html

Also the relations could be created in the following way:

Code: Select all

StiDataRelation dataRelation = new StiDataRelation("MyRelation", report.Dictionary.DataSources["MyDataSource1"], report.Dictionary.DataSources["MyDataSource2"], new System.String[]{"MyDataSource1ID"}, new System.String[] {"MyDataSource2ID"});
report.Dictionary.RegRelations();
report.Dictionary.Relations.Add(dataRelation);
Thank you.