Page 1 of 1
Replicate row based on field
Posted: Thu Mar 27, 2008 4:38 pm
by THE V
I was wondering if there was some way to use a field to replicate a data row.
For example I would like to take data like this..
Code: Select all
Plot Name Rep
101 Fred 5
102 Mike 2
103 Betty 3
And have an output in the report like this...
Code: Select all
Plot Name
101 Fred
101 Fred
101 Fred
101 Fred
101 Fred
102 Mike
102 Mike
103 Betty
103 Betty
103 Betty
I'm having to do this with hundreds of rows by insert - paste in excel and would like not to have to do this.
Thanks.
Replicate row based on field
Posted: Thu Mar 27, 2008 4:57 pm
by Vital
Hello,
You can use master-detail reports. Place two databands on page. Set MasterComponent of second databand to first databand. In BeforePrintEvent of first databand write following code:
Code: Select all
DataBand2.CountData = YourDataSource.Rep;
Thank you.
Replicate row based on field
Posted: Mon Mar 31, 2008 5:19 pm
by THE V
Vital,
Thanks for the answer. Maybe I'm not doing it correctly but I can't seem to get it to work.
I have one datasource table "S" with these three fields in them.
Plot Name Rep
Both databands refer to "S"
If DataBand1 contains the print fields I just a get the same line repeated over and over again until I stop it.
If Databand2 has the print fields I get all of the data repeated over and over again until I stop it.
Is there a circular loop in the logic if I refer both bands to the same source which is causing the repeat to infinity?
I have not used the Master Detail functionality yet so I am unsure of it's requirements. The demo guide uses several datasources.
Replicate row based on field
Posted: Tue Apr 01, 2008 4:58 am
by Edward
Please refer only First DataBand to "S" datasource.
DataBand2.MasterComponent = DataBand1
Also please set DataBand1.PrintIfDetailEmpty = true;
DataBand1.Height = 0;
Please open the attached report in the Demo.exe example application.
Thank you.
Replicate row based on field
Posted: Tue Apr 01, 2008 12:48 pm
by THE V
Thank you,
Now it works perfectly
Replicate row based on field
Posted: Tue Apr 01, 2008 3:05 pm
by Edward
Please let us know if any help is required.
Thank you.