Page 1 of 2

How to convert Databand as Recursive Band????

Posted: Fri Feb 02, 2007 5:52 am
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...!



How to convert Databand as Recursive Band????

Posted: Fri Feb 02, 2007 8:19 am
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.

How to convert Databand as Recursive Band????

Posted: Fri Feb 02, 2007 10:25 pm
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.

How to convert Databand as Recursive Band????

Posted: Sat Feb 03, 2007 3:47 am
by Vital
Can you specify amount of level data in your table or table can contain unlimited level of data?

How to convert Databand as Recursive Band????

Posted: Tue Feb 06, 2007 10:56 pm
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......




How to convert Databand as Recursive Band????

Posted: Wed Feb 07, 2007 3:45 am
by Vital
You can sort your data in right direction befoore report rendering?

Thank you.

How to convert Databand as Recursive Band????

Posted: Wed Feb 07, 2007 6:28 am
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.

How to convert Databand as Recursive Band????

Posted: Wed Feb 07, 2007 7:03 am
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.

How to convert Databand as Recursive Band????

Posted: Thu Feb 08, 2007 6:42 am
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.


How to convert Databand as Recursive Band????

Posted: Thu Feb 08, 2007 7:06 am
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.