views:

742

answers:

3

We have a small in house project that requires reporting. I'm trying to use reportviewer as it seems like it will do exactly as we require and didn't want to get bogged down with the complexity of crystal reports if I could help it.

I am trying to use a business object that I am passing to the report.rdlc. The problem is that the properties in my object are not driectly exposed. The properties I require are embedded within another object inside the top level object. As this is a WCF project I don't have much say about what goes on at the server end. I am just able to request these objects or Insert/Update/Delelte their info from the database. It is done in this way as the back end can use multiple flavours of database.

Here is what I can see after adding my business object as a DataSource:

-BusinessObject
 -CustomerInfo
  -ClientName
    -ColumnName
    -DisplayName
    -FieldName
    -IsNull
    -KeyColumn
    -SenondKeyColumn
    -StringValue 
  -ClientID
    -ColumnName
    -DisplayName
    -FieldName
    -IntValue
    -IsNull
    -KeyColumn
    -SenondKeyColumn
   +ClientAddress
   +Instrument
   +Telephone

etc etc

I need to be able to display, for example, the ClientName.StringValue field. If I drag the field I want onto the report I get:

=First(Fields!StringValue.Value)

This doesn't display anything when the report is run, I assume because it can't qualify what StringValue it is talking about and there could be many.

If I try dragging the ClientName object I get:

=First(Fields!ContactName.Value)

However ths gives:

#ERROR

When the report is run.

I would have thought you could use:

=First(Fields!ClientName.StringValue.Value)

but this won't even let me build.

Any advice greatly appriciated.

A: 

If you set the data source to the CustomerInfo instance (or list) returned from the service it should work. The ReportViewer control can be a little complicated when you start dealing with object hierarchies, but you don't have to do anything crazy or special if all the information is at the root level.

jezell
A: 

The problem was that the info wasn't at the root level. I worked it out though.

=First(Fields!ClientName.Value.StringValue, "BusinessObject_CustomerInfo")

I've got a pretty good grip of the ReportViewer component now cheers.

Matt Johnson
Will someone please make this as the answer.
Matt Johnson
A: 

Correct. But how can i populate a table with the list of addresses in the CustomerInfo

-BusinessObject -CustomerInfo
-ClientAddresses(IList) -ClientAddress1 -ClientAddress2 +Instrument +Telephone

John Saunders