Visual Studio Development Bookmark and Share   
 index > Visual Studio Report Controls > How do I Navigate / Walk through Entity hierarchy in ReportViewer RDLC?
 

How do I Navigate / Walk through Entity hierarchy in ReportViewer RDLC?

Hi

I've used the examples in earlier Posts w.r.t. Entities and ReportViewer Control to create an ObjectDataSource for my LINQ Entities and directly bound it a RDLC in local mode, and successfully set the Data Source at run time.

However, at this stage it seems that the RDLC created only allows access to the direct / immediate properties of the entity that I've bound.
e.g. in the below example I need to navigate the entity graph :
Service->ServiceType->Name

Has anyone managed to successfully 'walk' through the entity graph in RDLC, or will I need to flatten my entity graph in order to use properties of related entities in my report (i.e. First need to denormalise the complex Entity into a new wide Entity class containing all properties)

(i.e. meaning that there isn't any point in using entities in an RDLC. The LINQ language extensions could be used to create the 'flattened' entity, e.g. using a new anonymous class)

What I need is something like the 3rd Field listed below, where I need to reference a property of asubentity in the report

<DataSet Name="Service">
<Fields>
<Field Name="Code"> <!-- Simple Field is a direct Property on the Entity identified for the ObjectDataSource-->
<DataField>Code</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="ServiceType"> <!-- Many : One Entity Property on the Entity identified for the ObjectDataSource-->
<DataField>ServiceType</DataField>
<rd:TypeName>MyAssembly.Entities.ServiceType</rd:TypeName>
</Field>
<Field Name="ServiceTypeName"> <!-- "walked" field on the above Sub Entity-->
<DataField>ServiceType.Name</DataField>* Doesn't work
<rd:TypeName>System.String</rd:TypeName>
</Field>

Thanks in advance

Stuart
nonnb  Sunday, August 30, 2009 10:00 AM
Hi

I've used the examples in earlier Posts w.r.t. Entities and ReportViewer Control to create an ObjectDataSource for my LINQ Entities and directly bound it a RDLC in local mode, and successfully set the Data Source at run time.

However, at this stage it seems that the RDLC created only allows access to the direct / immediate properties of the entity that I've bound.
e.g. in the below example I need to navigate the entity graph :
Service->ServiceType->Name

Has anyone managed to successfully 'walk' through the entity graph in RDLC, or will I need to flatten my entity graph in order to use properties of related entities in my report (i.e. First need to denormalise the complex Entity into a new wide Entity class containing all properties)

(i.e. meaning that there isn't any point in using entities in an RDLC. The LINQ language extensions could be used to create the 'flattened' entity, e.g. using a new anonymous class)

What I need is something like the 3rd Field listed below, where I need to reference a property of a subentity in the report

    <DataSet Name="Service">
      <Fields>
        <Field Name="Code"> <!-- Simple Field is a direct Property on the Entity identified for the ObjectDataSource-->
          <DataField>Code</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="ServiceType"> <!-- Many : One Entity Property on the Entity identified for the ObjectDataSource-->
          <DataField>ServiceType</DataField>
          <rd:TypeName>MyAssembly.Entities.ServiceType</rd:TypeName>
        </Field>
        <Field Name="ServiceTypeName"> <!-- "walked" field on the above Sub Entity-->
          <DataField>ServiceType.Name</DataField>* Doesn't work
          <rd:TypeName>System.String</rd:TypeName>
        </Field>

Thanks in advance

Stuart
Hello,
  I'm having exactly the same problem. We've been using Crystal Reports for more than 10 years and are considering moving to Report Services due to the integration capabilities with our Business Entities. But this "possible" limitation makes things a little harder and personally I think it's a major flaw if it's true. I'm looking forward to the answer to this post.
José R. Rodrigues  Wednesday, October 07, 2009 10:22 AM

You can use google to search for other answers

Custom Search

More Threads

• Problem with newly added table
• Export ReportViewer to Excel
• How to elimate the Blank space in a Page Header of SQL Reporting services 2005
• ReportViewer not generating online
• Wierd Switch Expression Behaviour
• Grouping Question
• How do you cancel a remote report midstream using ReportViewer.ServerReport for Webforms
• No data in my rdlc from DataSet
• windows report: VS 2008 pro System.Windows.Forms is not a trusted assembly
• Dynamically generating report definition?