How to convert Databand as Recursive Band????

Stimulsoft Reports.NET discussion
jayakumargr
Posts: 85
Joined: Sat Jan 20, 2007 4:21 am

How to convert Databand as Recursive Band????

Post by jayakumargr »

Hi,
i have a table called category.it contains following columns category_id,parent_category.

sample data's are
category_id parent_category
1 ------------------ 0
2 ------------------ 1
3 ------------------ 1
4 ------------------ 2
5 ------------------ 2
6 ------------------ 4
7 ------------------ 4
how i generate a report like,

1----category_id
category-details
2-------sub_category1
sub_category1-details
4-----------sub_category2
sub_category2-details
6-------------- sub_category3
sub_category3-details


Please,Any One give me the guidelines......!

thanks in advance...!


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

How to convert Databand as Recursive Band????

Post by Edward »

Please use for this goal a new Hierarchical band.

You have to set the following properties of the Hierarchical band according your example:

DataSource = your DataSource
ParentValue = 0
KeyDataColumn = category_id
MasterKeyDataColumn = parent_category

But the result differs from yours. You will get the following:

Image

Thank you.
jayakumargr
Posts: 85
Joined: Sat Jan 20, 2007 4:21 am

How to convert Databand as Recursive Band????

Post by jayakumargr »

Hi Edward,
thanks for your reply. but i use stimulreport version 2006.4. i didn't get that hierarchical band. please provide any other solution....

thanks.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

How to convert Databand as Recursive Band????

Post by Vital »

Can you specify amount of level data in your table or table can contain unlimited level of data?
jayakumargr
Posts: 85
Joined: Sat Jan 20, 2007 4:21 am

How to convert Databand as Recursive Band????

Post by jayakumargr »

Hi Vital,
sorry for the late reply. My table contains unlimited level of data. that is subcategory contains many levels of subcategory. please provide the solution......(i am using stireport 2006.4 version)


thanks in advance......



Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

How to convert Databand as Recursive Band????

Post by Vital »

You can sort your data in right direction befoore report rendering?

Thank you.
jayakumargr
Posts: 85
Joined: Sat Jan 20, 2007 4:21 am

How to convert Databand as Recursive Band????

Post by jayakumargr »

Hi vital,
i sort category_id in ascending order. category_id datatype is vary from database to database. that is int to varchar.

thanks.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

How to convert Databand as Recursive Band????

Post by Vital »

Place all components on Databand to container. Container place on databand. After then add following code in BeforePrintEvent of Databand:

Code: Select all


Container1.Left = MyDataSource.level * 20; //20 depends from report units

Thank you.
jayakumargr
Posts: 85
Joined: Sat Jan 20, 2007 4:21 am

How to convert Databand as Recursive Band????

Post by jayakumargr »

Hi vital,

Container1.Left = MyDataSource.level * 20;

I tried this code. but it shows an error ("The Name MyDataSource does not exist in the current context")

In the above line MyDataSource specifies what ?

Please Provide the solution with example....

thanks.

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

How to convert Databand as Recursive Band????

Post by Edward »

MyDataSource - the DataSource in the report which is contains your data.
level - it is a field in the MyDataSource which contains an integer value which sets a level of the nesting that field in your tree. So you need additional field to build the report.
Example data:
Category_id parent_category level
1 ------------------ 0 -------------------0
2 ------------------ 1 -------------------1
3 ------------------ 1 -------------------1
4 ------------------ 2 -------------------2
5 ------------------ 2 -------------------2
6 ------------------ 4 -------------------3
7 ------------------ 4 -------------------3

Thank you.
Post Reply