Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subtract values from two different reports.

Status
Not open for further replies.

ReillyC

MIS
Feb 6, 2004
114
US
I created two reports.

In one report I count the number of applications that we received in a month using the following formula.
Formula:
//{@APRIL}:
If month ({TABAPP.APPDATE}) = 4 then 1 else 0
Then I insert the sum summary on the above formula.




In second report I count the number of application that we received that are consider to be a priority filing in each month using the following formula .

Formula:


//{@APRIL}:
If month ({TABAPP.PRIORITYDATE}) = 4 then 1 else 0
Then I insert the sum summary on the above formula.

Basically, I need to subtract the total # number of application (formula #1) from the total # of priority applications .

How do I set up a shared variable that will subtract my values for each month?

 
Why have you decided against using these formulas within one report? Are there multiple priority dates per app date? Or multiple app dates per priority date? In other words, are there duplicates within the fields when you do try this in one report? Otherwise, you should be able to insert grand totals on these and subtract the values in the report footer.

Anyway, if you need to use a subreport, first group on a formula {@monthappdate}in the main report:

month({tabapp.appdate})

Next insert a subreport, in which you group on another formula {@monthprioritydate}:

month({tabapp.prioritydate})

Then create a formula in the subreport {@prioritycnt}:

whileprintingrecords;
shared numbervar prioritycnt := count({tabapp.prioritydate},{@monthprioritydate};

Place this formula in the subreport group header or footer.

Link the subreport to the main report by choosing {@monthappdate} in the main report to link with {@monthpriority date} in the subreport. Then place the subreport in the group (appdate) header of the main report. Then you can place the calculation {@diff} in the group footer. If you want the calculation in the group header, then insert another group header section, so that the subreport is in GH#1a, and {@diff} will be in GH#1b, since the subreport must be in a section above where the shared variable is used. Then create {@diff} in the main report:

whileprintingrecords;
shared numbervar prioritycnt;

prioritycnt - count({tabapp.appdate},{@monthappdate})

Place this formula either in GH#1b or GF#1. If there is the possibility that the priority count might be null, you might have to add a reset formula in the main report to be placed above the subreport (either in a new group header section_a or in the group footer below where the {@diff} formula is located), so that the previous value is not carried forward:

whileprintingrecords;
shared numbervar prioritycnt := 0;

-LB

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top