Page 1 of 1

Databand newbie question

Posted: Tue Dec 11, 2012 1:46 pm
by groo
Hi, sorry for the newbie question, but I have browsed through all documentation and cannot find it. I have a couple of questions actually:

1. How do I configure a business objects data source, once the report is created? The only place I've found how to do it is using the Create new report Wizard. I have created a couple of pages of the report using plain variables, but now I have a longer list which I should insert.

2. Is it possible to bind the table to a list of string arrays? I.e.

Code: Select all

List<string[]>
? That way, each list item would be a single row, and I don't have to use strongly typed properties in a custom business object.

3. How do I remove the spacing between a DataBand and its header? When I place them in the designer, there is always a fixed spacing of two grid squares which I am not sure how to remove. Basically, I'd simply like my table headers to be attached to the table itself, with no spacing.

Thanks a lot for your time!

Re: Databang newbie question

Posted: Wed Dec 12, 2012 6:25 am
by Jan
Hello,
1. How do I configure a business objects data source, once the report is created? The only place I've found how to do it is using the Create new report Wizard. I have created a couple of pages of the report using plain variables, but now I have a longer list which I should insert.
You can use following static event:

Code: Select all

StiOptions.Engine.GlobalEvents.CreatedReportInDesigner += delegate(object sender, EventArgs e)
            {
                StiDesignerControl designer = sender as StiDesignerControl;
                List<string[]> strs = new List<string[]>();
                strs.Add("1");
                strs.Add("2");
                strs.Add("3");
                
                designer.Report.RegBusinessObject("Test", strs);
            };
2. Is it possible to bind the table to a list of string arrays?
This is not possible.
3. How do I remove the spacing between a DataBand and its header? When I place them in the designer, there is always a fixed spacing of two grid squares which I am not sure how to remove. Basically, I'd simply like my table headers to be attached to the table itself, with no spacing.
You can use ShowHeaders function. Please check attached image.

Thank you.

Re: Databang newbie question

Posted: Wed Dec 12, 2012 7:23 am
by groo
Thanks a lot, this was very quick and helpful.

Re: Databand newbie question

Posted: Wed Dec 12, 2012 7:49 am
by Alex K.
Hello,

Always glad to help you.
Let us know if you need any additional help.

Re: Databand newbie question

Posted: Wed Dec 12, 2012 9:01 am
by groo
Hi again, I have a problem with the first part, I phrased my initial question poorly.

Jan's answer stated that I should attach a handler to a static event:

Code: Select all

StiOptions.Engine.GlobalEvents.CreatedReportInDesigner
but I am not sure where to put that, or if this is what I actually need.

What I wanted to know is how to get my data sources to appear in the Designer while creating the report, to be able to reference them in a DataBand.

Before getting to this page, I simply used named variables ("{SomeVariable}"), which I was setting in runtime by adding StiVariables to the StiReport.Dictionary.Variables collection. I got stuck with the DataBand because it seems that it requires the business object to be "registered" before accessing them (I might be wrong).

For example, in the example for "Business objects/Collection of business objects", the code in the designer somehow already contains generated business classes ("ShippersDataSource", "ProductsDataSource", etc.). I am not sure how to make Designer build these. Thanks again!

Re: Databand newbie question

Posted: Thu Dec 13, 2012 7:19 am
by Alex K.
Hello,

Sorry, maybe we did not exactly understand your question.
You can use the following code:

Code: Select all

StiReport report = new StiReport();
report.RegBusinessObject("Data", YourBO);
report.Design();
Thank you.