Page 1 of 1

Number of rows depending on a certain field

Posted: Mon Mar 30, 2009 5:10 am
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.

Number of rows depending on a certain field

Posted: Mon Mar 30, 2009 9:35 am
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.

Number of rows depending on a certain field

Posted: Mon Mar 30, 2009 10:04 am
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

Number of rows depending on a certain field

Posted: Mon Mar 30, 2009 10:28 am
by Edward
Please see the report in the attachment and BeforePrintEvent of the DataBand.

MasterDataBand.PrintIfDetailEmpty must be set in true.

Thank you.

Number of rows depending on a certain field

Posted: Tue Mar 31, 2009 7:16 am
by Jennypi
Thanks a lot Edward, it is working perfectly.