Number of rows depending on a certain field

Stimulsoft Reports.NET discussion
Post Reply
Jennypi
Posts: 361
Joined: Mon Nov 17, 2008 7:13 am
Location: France

Number of rows depending on a certain field

Post by Jennypi »

Hi all,

I'm trying to build a report where the number of rows will be calculated according to a field (from the DB) containing a number.

If this field contains the number 3, then 3 rows will be created. The numbers 1, 2 and 3 will be visible in the corresponding rows.
If the field contains 10, 10 rows will be created. The numbers 1, 2... to 10 will be visible in the corresponding rows.

How can I do this?
I've been searching in the databand property box but could find something which helps.

Thanks a lot,
Jennifer.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Number of rows depending on a certain field

Post by Edward »

Hi Jennifer,

In the BeforePrintEvent of the attached report the following code has been used:

Code: Select all

Data1.CountData = Categories.Count;
for counting of lines it is very convenient to use Line function.

Thank you.
Jennypi
Posts: 361
Joined: Mon Nov 17, 2008 7:13 am
Location: France

Number of rows depending on a certain field

Post by Jennypi »

But it's not about counting lines, maybe I wasn't clear enough. I have this:
name | address | articles
Name1 address1 3

1
2
3

Name2 address2 5

1
2
3
4
5

Is it clearer? I want to create as many rows as the number in my field "articles"

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

Number of rows depending on a certain field

Post by Edward »

Please see the report in the attachment and BeforePrintEvent of the DataBand.

MasterDataBand.PrintIfDetailEmpty must be set in true.

Thank you.
Attachments
157.CountDataProperty.mrt
(16.71 KiB) Downloaded 329 times
Jennypi
Posts: 361
Joined: Mon Nov 17, 2008 7:13 am
Location: France

Number of rows depending on a certain field

Post by Jennypi »

Thanks a lot Edward, it is working perfectly.
Post Reply