Databand newbie question

Stimulsoft Reports.NET discussion
Post Reply
groo
Posts: 9
Joined: Tue Dec 11, 2012 1:39 pm

Databand newbie question

Post 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!
Last edited by groo on Wed Dec 12, 2012 7:23 am, edited 1 time in total.
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Re: Databang newbie question

Post 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.
Attachments
Sample.png
Sample.png (42.64 KiB) Viewed 1661 times
groo
Posts: 9
Joined: Tue Dec 11, 2012 1:39 pm

Re: Databang newbie question

Post by groo »

Thanks a lot, this was very quick and helpful.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Databand newbie question

Post by Alex K. »

Hello,

Always glad to help you.
Let us know if you need any additional help.
groo
Posts: 9
Joined: Tue Dec 11, 2012 1:39 pm

Re: Databand newbie question

Post 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!
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Databand newbie question

Post 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.
Post Reply