Page 1 of 1

Business objects with child collections

Posted: Fri Jul 29, 2016 7:50 pm
by naasking
I'm demoing Stimulsoft, and I have a report generated from a business object that has a child collection, something like:

Code: Select all

public class Order
{
  public string OrderNumber {get;set;}
  public IEnumerable<Product> Products {get;set;}
}
public class Product
{
  public string Name {get;set;}
}
I want to bind a data band to to the Order.Products collection. The obvious way seems to be creating a "child of business object" data source, but my dialog in the demo editor always has the child option greyed out like this. All of the other guides are for older version of the Stimulsoft designer, so they're no help.

I even tried adding the Product as its own data source and then defining a relation between Order and Products, but the "OK" button is always greyed out no matter what I specify in this dialog (I'm not sure if the relation would do what I want anyway).

I should also note that defining a new data source just for the collection that I have to manually bind via RegBusinessObject is not acceptable. I'm already calling RegBusinessObject on the top-level object which contains the child collection, I should just be able to extract the needed data from that.

Honestly, such a simple thing shouldn't be this complicated, and the video certainly makes it seem easy, so what am I missing?

Re: Business objects with child collections

Posted: Mon Aug 01, 2016 2:07 pm
by Alex K.
Hello,

Please try to use the SynchronizeBusinessObjects() method:

Code: Select all

report.RegBusinessObject("Demo", ds);
report.Dictionary.SynchronizeBusinessObjects(2);
Thank you.

Re: Business objects with child collections

Posted: Tue Aug 02, 2016 5:26 am
by naasking
I don't think you understand. I'm using the Stimulsoft designer to design a report. I can't tell the designer that I want to bind a data band to a child collection of an existing data source. There is no code involved here.

Re: Business objects with child collections

Posted: Tue Aug 02, 2016 10:39 am
by Alex K.
Hello,

We couldn't reproduce this bug.
Please send us a simple project which reproduces the issue for analysis.

Thank you.

Re: Business objects with child collections

Posted: Tue Aug 02, 2016 3:19 pm
by naasking
To be clear, I'm trying to update an existing report from an older version of Stimulsoft to the new version and switch it to use business objects. I can't even add a business object using the context menu, I had to add it as New Data Source > Data From Business Objects, so perhaps that's the source of the problem. How do I fix that?
test-report.png
test-report.png (53.78 KiB) Viewed 5494 times
I can see the appropriate selection in a new report, but not in existing reports. Also, when adding a child object for the new report, it doesn't let me select which column is the child. The "BOM" property of the "Bill" business object is an IEnumerable<BillOfMaterialRow>, but looking at the second attached image, it's not at all clear how this is supposed to work (and the documentation does not describe how to do this).
new-report-child.png
new-report-child.png (68.66 KiB) Viewed 5494 times
If I add the row class manually, it shows up as in the third image, but as a duplicate BOM property as in the third image. I have no idea if BOM is automatically populated from Bill.BOM or what's going on here.
child-report.png
child-report.png (68.51 KiB) Viewed 5494 times

Re: Business objects with child collections

Posted: Wed Aug 03, 2016 11:48 am
by Alex K.
Hello,

We couldn't reproduce this bug.
Please send us a simple project which reproduces the issue for analysis.

Thank you.

Re: Business objects with child collections

Posted: Wed Aug 03, 2016 6:31 pm
by naasking
I've sent a PM with the files.

Re: Business objects with child collections

Posted: Thu Aug 04, 2016 6:43 am
by Alex K.
Hello,

> I can't even add a business object using the context menu, I had to add it as New Data Source > Data From Business Objects, so perhaps that's the source of the problem.

Please try to set the EngineVersion property for your report to EngineV2.

Thank you.

Re: Business objects with child collections

Posted: Fri Nov 25, 2016 6:21 pm
by naasking
A bit late, but that fixed the issue, thanks!

Re: Business objects with child collections

Posted: Mon Nov 28, 2016 8:17 am
by Alex K.
Hello

We are always glad to help you!
Please let us know if you need any additional help.

Thank you.