Counting rows in Master /Detail

Stimulsoft Reports.NET discussion
Post Reply
Roger
Posts: 10
Joined: Wed May 30, 2007 9:39 am
Location: Dordrecht, The Netherlands

Counting rows in Master /Detail

Post 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
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Counting rows in Master /Detail

Post 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:

Code: Select all

Variable1 = 1;
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.
Roger
Posts: 10
Joined: Wed May 30, 2007 9:39 am
Location: Dordrecht, The Netherlands

Counting rows in Master /Detail

Post 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
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Counting rows in Master /Detail

Post 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.
Roger
Posts: 10
Joined: Wed May 30, 2007 9:39 am
Location: Dordrecht, The Netherlands

Counting rows in Master /Detail

Post 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!
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Counting rows in Master /Detail

Post by Edward »

Thank you for the good words.

Let us know if any help is required.

Thank you.
Post Reply