A quick question about XtraReports...


Author
Message
Robin J Giltner
Robin J Giltner
StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)
Group: Forum Members
Posts: 105, Visits: 650
We are attempting to use DevExpress's XtraReports for our reporting.  Simple tablelistings work great using a BusinessBindingSource. Drop that datasource onto the Report designer, and then before I call showpreviewdialog, I do a simple CopyDataFrom my local BO to my Report's DataSource Business Object.  Works fantastic.  One question that I do have, is that we have many many Master Detail reports to author for the users.  I can do this using DataSet's, but it completely bypasses the Business Object, and the data I already have in my Business Objects.

I tried things like accessing the Report's DataSource's DataTables, and copying data into them, but the Data source always just goes and grabs its own data from the SqlServer.

Has anyone, or is anyone using XtraReports for Master/Detail reporting and managed to use the Strataframe Business Object's DataTables to populate their report from?

Thanks,

Robin Giltner

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Have you tried to add the BusinessObjects' CurrentDataTables to a DataSet and use that as the data source for the report?

You could also use the BusinessObject.CurrentView.ToTable() method get DataTable references that you can add to a DataSet and then use that DS as your DataSource for the report; this way, you could use the data that's already in your business object.

Robin J Giltner
Robin J Giltner
StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)
Group: Forum Members
Posts: 105, Visits: 650
Thanks for the reply Ben.  I've tried setting each data table from the Datasource to my Business Object's data table by

Ctype(DexExReport.DataSource, DexExDataSet).Tables(0) = My.BusinessObject.CurrentView.toTable

But these data tables are read only.  So I try to reference the tables by

Dim loDT1 as DataTable = Ctype(DevExReport.DataSource, DevExDataSet).Tables(0)

loDT1 = My.BusinessObject.CurrentView.totable.Copy

And this gets data into the DataTable on the Report, but it still goes out and get data from SQL Server.  If I remove its Select Statement from the TableAdapter in the DataSet, it bombs out completely.

I also tried removing the DataTables, relations first, then adding my BO Tables to it, and the relation back in, but I think I was way over my head and that point and when it didn't work, I gave up.

Thanks,

Robin Giltner

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Robin.

I've been trying XtraReports, and this is how I accomplished a Master-Detail report:

Dim loYourParentTable As New boYourParentTable()

loYourParentTable.FillDataTable("Select * from YourParentTable")

Dim loYourChildTable As New boYourChildTable()

loYourChildTable.FillDataTable("Select * from YourChildTable")

Dim ds As New Data.DataSet

ds.Tables.Add(loYourParentTable.CurrentDataTable)

ds.Tables.Add(loYourChildTable.CurrentDataTable)

ds.Relations.Add("ListRelation", ds.Tables(0).Columns("parent_pk"), ds.Tables(1).Columns("child_parent_pk"), False)

DataSource = ds.Tables(0)

DataMember = "YourParentTable"

DetailReport.DataSource = ds.Tables(0)

DetailReport.DataMember = "ListRelation"

Me.lblParentCode.DataBindings.Add("Text", ds.Tables(0), "parent_Code")

Me.lblParentName.DataBindings.Add("Text", ds.Tables(0), "parent_Name")

Me.lblChildCode.DataBindings.Add("Text", ds, "ListRelation.child_Code")

Me.lblChildName.DataBindings.Add("Text", ds, "ListRelation.child_Name")

Just a sample, of course.

Hope it helps.

Robin J Giltner
Robin J Giltner
StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)
Group: Forum Members
Posts: 105, Visits: 650
Thanks Ivan.  I'll be giving it a try :-)

Thanks.

Robin Giltner

Jerome Barnett
Jerome Barnett
StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)
Group: Forum Members
Posts: 10, Visits: 65
Wow.....subconsciously I thought I had come up with this idea myself.....but reading the above posts I see where I got it.....oops!BigGrin



Anyway check my post here for a detailed explantion of Ben's solution

http://forum.strataframe.net/Topic8417-6-1.aspx



Jerome
Robin J Giltner
Robin J Giltner
StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)StrataFrame User (137 reputation)
Group: Forum Members
Posts: 105, Visits: 650
Thanks for the input all.  While working through the new Master Detail reports, I talked with our FoxPro developer and he pointed down an easy route using the DataSource_RowChanged event on the report.

Using this even, I can populate the subsequent Detail Report's datasource and Fill with the proper records.  This can cascade down as many times as I need, as I have Master-Detail-Detail-Detail-Detail reports to work on.

Using this way, I simply use my BusinessBindingSources to populate from and I don't require any typed DataSets.

Thanks again all.

Robin Giltner

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search