xtraReports and TypedLists

Posts   
 
    
caseyry
User
Posts: 79
Joined: 25-Feb-2005
# Posted on: 29-Aug-2005 16:52:40   

Hi --

Does anyone have experience with DevExpress's XtraReports (v. 1.8.5) and LLBL Gen Pro?

I'm having issues creating a "Master-Detail" report where the "Detail" reports do not display any data. XtraReport's tech. support response was (basically) asking me why XtraReports couldn't find or navigate the relationship between the parent (a "standard" .NET datatable) and the child (an LLBL Gen Pro typed list). Both of the objects were in a dataset with a relationship defined between them.

I do have XtraReports working fine with Typed Lists that are not used in a Master-Detail report.

I'm still working with XtraReports Tech Support, but any tips or suggestions would be greatly appreciated.

Thanks, -Ryan Casey

omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 29-Aug-2005 19:42:07   

When I want to build a master-detail report with XtraReports, I use an EntityCollection that expresses my Relations. I found that to be more intuitive than trying to paste things together with DataTables.

caseyry
User
Posts: 79
Joined: 25-Feb-2005
# Posted on: 29-Aug-2005 21:35:07   

omar wrote:

When I want to build a master-detail report with XtraReports, I use an EntityCollection that expresses my Relations.

I don't quite follow what you are saying. Can I use an EntityCollection that includes 2 different entities/tables? (I know I can use relations to filter what rows are included in the collection that is returned.) I thought that an entity was always equal to a specific table in the database. That's why I was using TypedLists because I need to display data from several different tables in one "line" on the report.

Thanks, -Ryan

Paul.Lewis
User
Posts: 147
Joined: 22-Aug-2005
# Posted on: 30-Aug-2005 04:00:44   

caseyry wrote:

I don't quite follow what you are saying. Can I use an EntityCollection that includes 2 different entities/tables?

Ryan,

Using an Entity and PreFetch paths you can load all of your Master-Detail data in one database round-trip. Take a look at the LLBLGen User Manual - generated code - Prefetch Paths for details.

Master : Customer Entity Detail : Customer.Orders Related Collection

PreFetches also apply to collections.

caseyry
User
Posts: 79
Joined: 25-Feb-2005
# Posted on: 30-Aug-2005 15:40:10   

Paul.Lewis wrote:

Using an Entity and PreFetch paths you can load all of your Master-Detail data in one database round-trip.

Excellent. Thanks for the suggestion.

-Ryan Casey

caseyry
User
Posts: 79
Joined: 25-Feb-2005
# Posted on: 02-Sep-2005 00:37:49   

Ok, I know this isn't a DevExpress support forum smile , but does anyone know if it is possible to do display data from child objects?

e.g.: Master Entity: Order Detail Source Entity: Customer.CustomerType.Name

I'm trying to generate a report that, on a single line, contains data from two different entities.

Thanks.

jeffreygg
User
Posts: 805
Joined: 26-Oct-2003
# Posted on: 02-Sep-2005 01:11:03   

caseyry wrote:

Ok, I know this isn't a DevExpress support forum smile , but does anyone know if it is possible to do display data from child objects?

e.g.: Master Entity: Order Detail Source Entity: Customer.CustomerType.Name

I'm trying to generate a report that, on a single line, contains data from two different entities.

Thanks.

Hey, there. I would check out "Fields Mapped on Related Fields" in the designer in the entity detail. There's also good information on this in the docs. Basically, you'll be adding a new field in your entity that mirrors the field in the related entity.

Jeff...

caseyry
User
Posts: 79
Joined: 25-Feb-2005
# Posted on: 02-Sep-2005 23:00:14   

jeffreygg wrote:

Hey, there. I would check out "Fields Mapped on Related Fields" in the designer in the entity detail. There's also good information on this in the docs. Basically, you'll be adding a new field in your entity that mirrors the field in the related entity.

Thanks for the suggestion. Unfortunately, that won't work for all cases as there are M:N relationships which I have to include, though it will work for some reports.

I think for some reports I'm going to have to break down and not use LLBLGen directly...oh well.

-Ryan

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 03-Sep-2005 18:28:56   

Can you give an example of a report that you think you won't be able to run and we may be able to tell you about a different way to do things in LLBLgen.

caseyry
User
Posts: 79
Joined: 25-Feb-2005
# Posted on: 07-Sep-2005 15:26:09   

bclubb wrote:

Can you give an example of a report that you think you won't be able to run and we may be able to tell you about a different way to do things in LLBLgen.

Gladly.

Basically, the report has a "master" band which lists all of the wines. Then for each wine, it should show data about the additions for the wine. The line item for additions consists of data from about 5 tables (mostly lookup tables). However, there are a couple of 1:M relationships which prevent using "Fields Mapped on related fields" as report fields.

Here's a text representation of how a typical report would look. (The spacing may not work properly.)

Wine 1

AdditionName ContainerName AdditionTypeName Foo X C Foo Y D Bar X E

Wine 2 AdditionName ContainerName AdditionTypeName Gpo X C Gpo Y D Apc X E

Rough table structure: Wine Container-Wine (wine.wine_id = Container-wine.wine_id; 1:M relationshipt with Wine) Addition-Container (Container-wine.addition_id = addition-container.addition_id); Addition (1:N relationship with Addition-Container; addition.addition_id = addition-container.addition_id)

I can create a typed list that represents the addition data fine, but I haven't been able to "bind" the typed lists in a Mater-Detail report in DevXpress reports properly for the detail bands.

Does this make sense?

(For what it's worth, I don't think this is a problem with LLBLGen.)

Thanks.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39884
Joined: 17-Aug-2003
# Posted on: 09-Sep-2005 11:17:08   

long shot: master-detail in that report engine might only work with a single dataset and a datarelation in place. A typedlist is a single datatable, if you create a dataset, add all the typedlists to that dataset and create datarelation objects between the datatables to illustrate the relations, does it work then?

One of the things a report engine has to deal with is a currency manager. On a form, this is a given, the form has one and it takes care of keeping a master and a detail in sync, if you bind the same collection/dataset to it. On a form, the report engine has to do this, and it might be they just only work with a dataset and datarelations...

Frans Bouma | Lead developer LLBLGen Pro
caseyry
User
Posts: 79
Joined: 25-Feb-2005
# Posted on: 09-Sep-2005 15:41:23   

Otis wrote:

long shot: master-detail in that report engine might only work with a single dataset and a datarelation in place. A typedlist is a single datatable, if you create a dataset, add all the typedlists to that dataset and create datarelation objects between the datatables to illustrate the relations, does it work then?

Thanks, but that's what I tried, and it doesn't work. No data is displayed for the detail band. I created a similar report with just "standard" .NET data adapters, data tables and a dataset and I have a similar problem. So, it could very well be that I'm not binding the datasource to the report properly. (I sent the simple project off to DevExpres support, so maybe that will help resolve the problem.)

If I do get this working, I will definitely post what I did.

Thanks.

caseyry
User
Posts: 79
Joined: 25-Feb-2005
# Posted on: 13-Sep-2005 19:38:54   

For what it's worth...

I've gotten it to work properly for Master-Detail reports that only have one level of detail. I'm getting an ArgumentException with DevExpress's components for a Master-Detail report with 2 detail levels (e.g. Suppliers.Products works, Suppliers.Products.Orders does not).

As Frans suggested, the method for creating the reports is: 1. Create a DataSet 2. Add TypedLists to the DataSet and create the relationship between the Parent and child tables. 3. Bind the report's dataSource to the DataSet 4. Bind the report's DataMember to the name of the relationship 5. Bind the detail report's controls (labels, table cells, etc.) with the DataMember set to RelationShipName.ColumnName. The Master controls should be bound using MasterTableName.ColumnName.

Sample code:


// Master (parent) band
wines = WineCollection.GetMultiAsDataTable(selectFilter, 0, sortClause);
wines.TableName = TABLE_NAME_WINE;
reportDS.Tables.Add(wines);

wineAddition.Fill(0, additionSortClause, false, selectFilter);
wineAddition.TableName = TABLE_NAME_WINE_ADDITION;      

reportDS.Tables.Add(wineAddition);
reportDS.Relations.Add(RELATIONSHIP_NAME_WINE_ADDITION, wines.Columns[(int)WineFieldIndex.WineId], wineAddition.Columns[(int)WineAdditionSummaryTypedListFieldIndex.WineId]);


this.DataSource = reportDS; //DataSet which stores all datatables.
this.DataMember = TABLE_NAME_WINE;

additionReport.DataSource = reportDS;
additionReport.DataMember = RELATIONSHIP_NAME_WINE_ADDITION; 

yAdditionComments.DataBindings.Add("Text", reportDS, RELATIONSHIP_NAME_WINE_ADDITION + "." + wineAddition.Columns[(int)WineAdditionSummaryTypedListFieldIndex.Description].ColumnName);


Also, the XtraReports sample projects set the DataMember field for Detail reports to be "ParentTableName.ChildTableName" not the name of the relationship. Using the TableName.ChildTableName doesn't work with TypedLists.

I don't know what's going on when I try to create a report with a 3rd level of detail. For some reason, XtraReports seems to have issues navigating the heirachy.

If I have 3 tables, with the relationship like: Wine->movements->wineMovementContainerFrom, I assume that I just define the relationship to be between the 2nd and 3rd table, since there is already a relationship from the 1st to 2nd table.


// 2nd -> 3rd table relationship
reportDS.Relations.Add(movements.Columns["PKFieldName"], wineMovementContainerFrom.Columns["FKFieldName"]);

Is that correct?

Thanks.

(At the risk of veering even farther off topic, here's the XtraReports Stack trace for the exception, in case anyone has seen this before.)

System.ArgumentException: WineWineMovement.WineMovementFrom at DevExpress.Data.Browsing.DataContext.GetDataBrowserInternal(Object dataSource, String dataMember) at DevExpress.Data.Browsing.DataContext.get_Item(Object dataSource, String dataMember) at DevExpress.XtraReports.Native.XRDataContext.get_Item(Object dataSource, String dataMember) at DevExpress.XtraReports.UI.XtraReportBase.get_DataBrowser() at DevExpress.XtraReports.UI.XtraReportBase.WriteToDocument(DocumentBuilder docBuilder) at DevExpress.XtraReports.Native.Printing.DetailWriter.WriteDetail() at DevExpress.XtraReports.Native.Printing.DetailWriterWithDS.WriteInternal()

at DevExpress.XtraReports.Native.Printing.DetailWriter.Write() at DevExpress.XtraReports.Native.Printing.DocumentBuilder.Build() at DevExpress.XtraReports.UI.XtraReportBase.BuildDocument(DocumentBuilder builder) at DevExpress.XtraReports.UI.DetailReportBand.BuildDocument(DocumentBuilder builder) at DevExpress.XtraReports.UI.XtraReportBase.WriteToDocument(DocumentBuilder docBuilder) at DevExpress.XtraReports.Native.Printing.DetailWriter.WriteDetail() at DevExpress.XtraReports.Native.Printing.DetailWriterWithDS.WriteInternal() at DevExpress.XtraReports.Native.Printing.DetailWriter.Write() at DevExpress.XtraReports.Native.Printing.DocumentBuilder.Build() at DevExpress.XtraReports.Native.Printing.RootReportBuilder.Build() at DevExpress.XtraReports.UI.XtraReportBase.BuildDocument(DocumentBuilder builder) at DevExpress.XtraReports.UI.XtraReport.BuildDocument(DocumentBuilder builder) at DevExpress.XtraReports.UI.XtraReport.CreateDocument(PrintingSystem ps, Single progressRange) at DevExpress.XtraReports.UI.XtraReport.CreateDocument(Single progressRange) at DevExpress.XtraReports.UI.XtraReport.CreateIfEmpty(Single progressRange) at DevExpress.XtraReports.UI.XtraReport.ShowPreview()

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39884
Joined: 17-Aug-2003
# Posted on: 14-Sep-2005 11:17:59   

caseyry wrote:

Also, the XtraReports sample projects set the DataMember field for Detail reports to be "ParentTableName.ChildTableName" not the name of the relationship. Using the TableName.ChildTableName doesn't work with TypedLists.

I don't know what's going on when I try to create a report with a 3rd level of detail. For some reason, XtraReports seems to have issues navigating the heirachy.

If I have 3 tables, with the relationship like: Wine->movements->wineMovementContainerFrom, I assume that I just define the relationship to be between the 2nd and 3rd table, since there is already a relationship from the 1st to 2nd table.


// 2nd -> 3rd table relationship
reportDS.Relations.Add(movements.Columns["PKFieldName"], wineMovementContainerFrom.Columns["FKFieldName"]);

Is that correct?

Yes, that should be the case I think. TypedLists get a name, or better: their datatables get a name, namely the name of the typedlist/view. This might be the problem?

Frans Bouma | Lead developer LLBLGen Pro
caseyry
User
Posts: 79
Joined: 25-Feb-2005
# Posted on: 14-Sep-2005 21:45:34   

Otis wrote:

Yes, that should be the case I think. TypedLists get a name, or better: their datatables get a name, namely the name of the typedlist/view. This might be the problem?

I'm not quite sure I follow what you mean. In the code snippet I left the name of the relationship out to make it more readable, but when I create the relationships I do give them a name and use that same name later to reference the relationship.

Thanks.