Page 1 of 1

Trouble with business objects

Posted: Wed Oct 10, 2018 3:01 pm
by Tobias
Having a business object with two List<T> properties, I'm having trouble with printing those lists. Instead of printing the first list and then the second one, it prints the first, the second and then AGAIN the first and the second.

Any ideas why this doesn't work?

MRT-File attached, code looks like this:

Code: Select all

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        var stiReport = new StiReport();
        stiReport.Load("Report.mrt");
        stiReport.RegBusinessObject("Foo", new BusinessObject
        {
            List1 = new List<Foo>
            {
                new Foo { Number = 1, Name = "Walter"},
                new Foo { Number = 2, Name = "Rick"},
            },
            List2 = new List<Foo>
            {
               new Foo { Number = 10, Name = "Maura"},
               new Foo { Number = 11, Name = "Veronica"}
            }
        });
        stiReport.Dictionary.SynchronizeBusinessObjects(2);
        stiReport.Design();
    }
}

public class BusinessObject
{
    public List<Foo> List1 { get; set; }
    public List<Foo> List2 { get; set; }
}

public class Foo
{
    public int Number { get; set; }
    public string Name { get; set; }
}

Re: Trouble with business objects

Posted: Fri Oct 12, 2018 1:11 pm
by Lech Kulikowski
Hello,

Please add main BO level on the page for correct rendering.

Thank you.

Re: Trouble with business objects

Posted: Fri Oct 12, 2018 2:59 pm
by Tobias
Ok, I see - not exactly "intuitive", but it works this way. Thanks!

Re: Trouble with business objects

Posted: Fri Oct 12, 2018 6:11 pm
by Lech Kulikowski
Hello

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

Thank you.