I have an object that has a child collection:
class Person
{
public string Name { get; set; }
public ICollection<PhoneNumber> PhoneNumbers { get; set; }
}
class PhoneNumber
{
public string Name { get; set; }
public string Number { get; set; }
}
The amount of those phone number can vary greatly. Tha table I need to get in the end:
---------------------------------
| John Doe | Home: +1-800-666 |
| | Work: +1-800-777 |
---------------------------------
| Homer Si | Home: +1-800-111 |
| | Work: +1-800-222 |
| | Mobile: +1-800-333 |
---------------------------------
(I hope that it is obvious which fields are which in the above illustration) I can rework the data classes as I wish. I need to retain the formatting (I mean that the phone numbers must be aligned on one line as shown above).
The question is - what is the best way to do this? The major limitation I have is that I cannot write any code-behind for the report. I can only use the report XML (with subreports if needed, but keep in mind - no code-behind).
Is it at all possible?
PS I am using 2008 local reports
Well, we did not exactly find a solution to the question, but I can just say this: we basically ended up providing SQL-like structures as results of data queries. Because this is the way reporting services want it to be.
And believe me - just give up on trying to achieve some custom functionality in reporting. Just stop struggling and use the default methods.
As I mentioned, we used a SQL-like JOIN to get the desired format. The data returned from out provider is now in the following form:
______________________________________
|PersonName | PhoneType | PhoneNumber|
|___________|___________|____________|
|John Doe | Home | +123456 |
|John Doe | Work | +098765 |
|___________|___________|____________|
|Homer S. | Mobile | +654432 |
|Homer S. | Home | +654431 |
|Homer S. | Work | +654433 |
|___________|___________|____________|
And we just group the tablix on PersonName so that in the report it looks like this:
______________________________________
|PersonName | PhoneType | PhoneNumber|
|___________|___________|____________|
|John Doe | Home | +123456 |
| | Work | +098765 |
|___________|___________|____________|
|Homer S. | Mobile | +654432 |
| | Home | +654431 |
| | Work | +654433 |
|___________|___________|____________|
That is it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.