Page 1 of 1
Counting rows in Master /Detail
Posted: Tue Mar 11, 2008 3:51 pm
by Roger
Hi
I have created a Master / Detail report.
I am using the {Line} to count the rows in the first Databand (master part)
Now I would like to continue counting the rows in the second Databand (detail part)
I can not find a solution.
Can you help?
Thanks in advance!
Roger
Counting rows in Master /Detail
Posted: Tue Mar 11, 2008 10:17 pm
by Edward
Yes, it is possible to count all rows in the Master-Detail report.
1. If instead of Line function you would add the {LineThrough} function to the Detail databand, then rows in the detail is counted without taking into account MasterBands.
2. Also if numeration starts with "1" for each MasterBand, then MasterBand could have the following expression:
{LineABC} {1} (it doesn't matter Line or LineRoman or LineThrough is used here - just an example)
DetailBand:
{Line+1}
3. If necessary the same numbering for all rows and no matter the MasterData it is or not, then custom Variable from the Dictionary can be used for counting all the rows.
Your steps in that case are the following:
Declare an int variable Variable1 in the Dictionary of the report.
In the BeginRenderEvent of the report this variable must be assigned to its initial value:
Place the text components on the MasterBand and on the DetailBand with the following expression:
{Variable1++}
I think one of these ways is suitable in case of your report, if not then please let me know.
Thank you.
Counting rows in Master /Detail
Posted: Thu Mar 13, 2008 8:26 am
by Roger
Hi Edward,
Thanks for the reply.
I am trying your suggestions.
I dont understand suggestion 3.
Can you specify the location in code of the BeginRenderEvent?
Or shoud I put it in the code-behind of the aspx page?
Thanks!
Roger
Counting rows in Master /Detail
Posted: Thu Mar 13, 2008 10:33 am
by Edward
Rocketweb wrote:I dont understand suggestion 3.
Can you specify the location in code of the BeginRenderEvent?
Or shoud I put it in the code-behind of the aspx page?
In the Designer just click once outside the Page and the report object will be selected in the PropertyEditor.
The BeginRenderEvent is used for the case of double-pass reports to reset (or sometimes not) a Variable to its initial state.
Thank you.
Counting rows in Master /Detail
Posted: Sat Mar 15, 2008 9:48 am
by Roger
Thanks!
I have it working now.
Counting is also working without the initialisation of the variable in the BeginRenderEvent.
[Off topic]
I really appriciate the way you respond the my questions: quick with detailled answers!!
Keep up the good work!
Counting rows in Master /Detail
Posted: Tue Mar 18, 2008 12:35 pm
by Edward
Thank you for the good words.
Let us know if any help is required.
Thank you.