Page 1 of 2

Count datarows in subreport

Posted: Thu Oct 25, 2007 1:22 am
by ChristianH
I have a report with two subreports included.
Top position of the lower subreport2 should depend on the heigt of the upper subreport 1.

I can´t achive this by using dock property because there are texts between the subreports and this results in wrong dock order.
Counting the datarows of subreport1 (with count()) would also be a solution but how can I get datarows of subreport2 from mainreport ?

Count datarows in subreport

Posted: Thu Oct 25, 2007 9:11 am
by Guest
For getting amount datarows of second subreport you can use a variable. Create a new variable: CountRows(type: int, default value: 0), write in the RenderingEvent of data band in the second subreport:

Code: Select all

CountRows++
and set property "Number of Pass" of the report to "Double Pass", then you will get the number of datarows in the second subreport.

Thank you.

Count datarows in subreport

Posted: Thu Oct 25, 2007 10:29 am
by ChristianH
Thanks for the hint.

I´ve tried your solution but now there occurs another problem:
My subreport works with a hierachical band and the output now looks like this:
. parent
. parent
. parent

instead of
. parent
. child
. child

Maybe this is a result of the double pass ?

Count datarows in subreport

Posted: Fri Oct 26, 2007 6:45 am
by Guest
We have tested some reports with hierachical bands concerning your problem, and couldn't reproduce behaviour:
.parent
.parent
.parent

instead of
.parent
.child
.child

Send to support@stimulsoft.com your report with few sample data. We will checkup it.

Thank you.

Count datarows in subreport

Posted: Mon Oct 29, 2007 2:35 am
by ChristianH
Your right, your solution is working. I ´ve made some mistakes... :brick:
Thanks.

Count datarows in subreport

Posted: Mon Nov 05, 2007 4:30 am
by ChristianH
Unfortunately there is another problem with this solution:
When I start the report the first time the rows count in subreports returns 0.
After a refresh or showing second time the result is ok.

Count datarows in subreport

Posted: Thu Nov 08, 2007 7:46 am
by Guest
We have tested this issue and we have always a nice result. May be, you use a report with some specific conditions?

Thank you.

Count datarows in subreport

Posted: Thu Nov 08, 2007 8:12 am
by ChristianH
You are right !
It was again a data failure from my side as I ran the report first time with missing data..

Can you please give me an overview of the correct order of steps when processing a report ?
(1. report.load, 2. regdata, 3. synchronize ...)

Count datarows in subreport

Posted: Thu Nov 08, 2007 11:10 am
by Guest
You must use first

Code: Select all

report.Load()
then

Code: Select all

report.RegData()
or use this methods in reverse order, but then you must use

Code: Select all

report.Dictionary.Synhronize()
after first two methods.

Thank you.

Count datarows in subreport

Posted: Tue Nov 13, 2007 3:04 am
by ChristianH
Regarding my original problem with counting datarows: I now have a new report structure:

I´ve got a mainpage where I a place a subreport (subreport1) ten times on one page (two columns, five rows)

Into subreport1 I´d like to place another subreport (subreport2) with the hierarchical band where I have to count datarows.
The number of datarows in subreport2 again determines the height of subreport2 in subreport1.
The problem now is, that subreport2 is called ten times (plus some more counts !?) and so the number of rows is counting up wrong.

Isn´t there an easier way to get the number of rows of the hierarchical band?
I would be happy if I just could get the number of datarows in one of my datatables.