Michael,

Here's a better approach that I thought of that is even simpler. It doesn't
require the addition of a new panel, the redesign of your data structure, or
the copying of records; nor does it have any multi-user concerns.

Assuming that your receipt numbers run fairly contiguously and that you want
to report on a set range of receipt numbers, you write a report that simply
steps through that set of receipt numbers and pulls the data for any records
that match them. You would use a report variable to hold the receipt number
and set it to your starting number at the beginning of the report. Then,
using virtual subreports to the Advertiser and Subscriber payment panels,
you look for a matching receipt number in either panel and print the info if
found. Then increment the receipt number RV by one and check to see if
you've hit the last one you want. If so, stop the report using a 'Stop
Report if RV is False' command. Otherwise loop using a 'Report Report if RV
is True' command.

If both the Advertiser and Subscriber payment panels have an index sorted
first by Receipt Number, this report can run very efficiently and collect
the data quickly.

Psuedo-code:

[Report based on ANY panel that has at least one record in it]
---First Page Header---
Assign RV1: 221  /* starting receipt number */
Assign RV3: 0 /* payments total */
---Report Body---
---Virtual Subreport to Advertiser Panel---
[Index starts with receipt number field]
[Links using RV1]
Print payment info ...
Assign RV3: RV3+payment amount
---End of SubReport---
---Virtual Subreport to Subscriber Panel---
[Index starts with receipt number field]
[Links using RV1]
Print payment info ...
Assign RV3: RV3+payment amount
---End of SubReport---
Assign RV1: RV1+1
Assign RV2: RV1 <=225 /* ending receipt number */
---Stop if RV2 is False---
---Repeat if RV2 is True---
---Final Footer---
Print the totals info from RV3

Of course, you would likely want to pick your starting and ending receipt
numbers some other way than hard-coding them into the report. That part's up
to you. You could prompt for them at the beginning of the report. Or you
could do a preliminary run through the Advertiser and Subscriber panels to
find the receipt numbers within a certain date range. Or you could figure
out when to stop the report on the fly as you process the records in the
Advertiser and Subscriber panels.

The neat thing about linking the virtual subreports using the receipt number
is that if there is no record with that receipt number in the subpanel,
nothing will be printed. If there happened to be multiple entries with the
same receipt number, it still works correctly.

Tim Rude

----- Original Message ----- 
From: "Michael Iannantuoni" <[EMAIL PROTECTED]>
To: "Dataperfect Users Discussion Group" <[email protected]>
Sent: Wednesday, May 02, 2007 2:29 AM
Subject: Re: [Dataperf] Totalling across Panels


<snip>
> >>
> >> *Receipt      Name & Amount*
> >> 0221        Smith (Advertiser) £20
> >> 0222        Jones (Advertiser) £30
> >> 0223        Brown (Subscriber) £6
> >> 0224        Walker (Advertiser) £20
> >> 0225        Dexter (Subscriber) £6
> >>
> >> Total: £82
> >>
> >> Anyone any ideas on the best way to do this please?
> >>

_______________________________________________
Dataperf mailing list
[email protected]
http://lists.dataperfect.nl/mailman/listinfo/dataperf

Reply via email to