How does a hierachical report work with object datasource?

Stimulsoft Reports.WPF discussion
Post Reply
drhkocher
Posts: 15
Joined: Thu Aug 06, 2009 1:43 pm
Location: Germany

How does a hierachical report work with object datasource?

Post by drhkocher »

I have a two classes X and Y. X contains Y objects. The list of Y should be hierarchical because the Y objects exist at different levels (they have a id and parentid key).

In the list of Data Sources I have X and X_Y.

Now I place a normal DataBand DB1 for X. This is my master. DataSource=X

Now I place a HierachicalDataBand after DB1. This is for the hierarchical details Y. It's called DB2.

DataSource DB2 = X_Y
Relation = X_Y
Master=DB1

Y has two keys: id and parentid.
From the menu, I can only select X_Y.id and X_Y.parentid. When the report is compiled i get an error that in the ctor the fields X_Y.id,... are not known. I think this is because they should be local names instead of global names. Anyway, it doesn't seem to work.

Any ideas?
Hartmut
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

How does a hierachical report work with object datasource?

Post by Jan »

Hello,

Please send your report (sample project) for examination to support@stimulsoft.com.

Thank you.
drhkocher
Posts: 15
Joined: Thu Aug 06, 2009 1:43 pm
Location: Germany

How does a hierachical report work with object datasource?

Post by drhkocher »

As I am out of town, here a simple recap from memory:

class X {

public List _myY = new List();

public IEnumerable YData {get{return _myY;}}

}

class Y {
int Id {get;set;}
int ParentId {get;set;}

}

If you fill in some data for X and Y, then register an object of X.

Now you can add a data band for X and a hiearchical data band for the YData relation. If you try to bind Id and ParentId of Y to the key properties of the hierarchical band, you get an exception...

Hope this helps.
Hartmut
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

How does a hierachical report work with object datasource?

Post by Edward »

Hi Hartmut,

I reproduced the situation you described. Everything worked correctly. Maybe were some other tips you did not mention?

Thank you.
drhkocher
Posts: 15
Joined: Thu Aug 06, 2009 1:43 pm
Location: Germany

How does a hierachical report work with object datasource?

Post by drhkocher »

Then I am sorry. I am away from the project for another 2 weeks. So you have to wait until i can send you the "real" project.

Basically, a datasource "X_Y" is created and in the combobox for the key I can only select "X_Y.Id" instead of "Id". Same for ParentId. So it has to do with nesting. In reality. I am registering a list of X. So this would give you L -> X -> Y with sources L, L_X, L_X_Y. If you bind the latter to the hierachical grid, the keys in the combobox are show hierarchical too (instead of using the local Id and ParentId properties).

Unfortunately, if this doesn't help you have to wait until I can extract my project and send it to you, sorry.

Hartmut
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

How does a hierachical report work with object datasource?

Post by Edward »

Hi

No problem. Please send the test project to support[at]stimulsoft.com when you can.

Thank you.
Post Reply