This is a migrated thread and some comments may be shown as answers.

Entity Framework and Reporting, accessing to parent data

1 Answer 130 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michele
Top achievements
Rank 2
Michele asked on 22 Nov 2011, 04:45 PM
Hello Telerik,
I've currently developed a report that uses EF to retrieve the data (in the true DevForce's IdeaBlade), I've the main report then a subreport where I've attached my 1...N items and the data are shown correctly...
Now I need to show in the subreport a property that's not defined in the data below... how can I access to the data via expression editor?

Consider this

MainObject

ID
Description
Country
IEnumerable<ChildObject> xxx

I need in the subreport that's bound to item of type ChildObject to access to Country property

Using QuickWatch I've seen that the item I'm looking for can be accessed with

var dataContext = ((IdeaBlade.EntityModel.EntityReferenceBase)(((IdeaBlade.EntityModel.RelatedEntityList<MainObject>

Can someone help me out?
Thanks

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 23 Nov 2011, 05:59 PM
Hello Paolo,

Generally in order to utilize nested collections our suggestion is to nest data items (subreports, table, list,crosstab, chart) and set the data items' datasource property with binding to the field representing the complex type. Generally the easiest approach is to use Crosstab/List/Table item because you don't have to create additional report for every data level.

However bindings are executed at runtime. Thus the expression editor can't resolve and list the available fields in design time but you can use the nested collection fields in expressions.

All the best,
Peter
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

Tags
General Discussions
Asked by
Michele
Top achievements
Rank 2
Answers by
Peter
Telerik team
Share this question
or