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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shared Numbervar for sum 2 tables

Status
Not open for further replies.

yolly12

MIS
Mar 21, 2005
83
0
0
Environment: Crystal 8.5 developer. SQL 2000 SP4, GoldMine CE 6.7

Hello,

I am writing a report that I need to display a total sum of activities by month. Problem si that some activities are still pending (CAL) and some are closed (CONTHIST). I came up with the idea of a shared numbervar since the data is displayed in subreports and now i just need to add it up.

So I created a formula for sales:

If ({cal.rectype}) startswith "S" then 1 else 0

then i created a shared numbervar

shared numbervar countcal;
countcal := count(@sales)

then on the main form, I created another formula for closed activities

If ({conthist.rectype}) startswith "S" then 1 else 0

then created a display formula

while printing records;
shared numbervar countcal + count{@closed sales};

the number dispalying is not correct. i checked the first set on the subreport on it's own and it displays the totals but the shared numbervar is not sorting by month (I have a group for createon date, sort by month) the first formula is fine though. The shared numbervar shows the correct total. As for the completed one, I have no idea of where it gets it's number from.

any ideas?

thanks in advance for the help
 
Where in the main report are the subreports?

Where are you attempting to display results? You need to reference specifics, showing the sections you intend to do things in...We don't know what a completed one means, use real technical terms.

I'll assume that you need to have the main report linked to the subreport on the dates, but it's hard to tell.

Please post specifics about where things are, and what and where you need todisplay results.

-k
 
the main report has 2 groups, one for the userid and then the next one is the date.

The subreports are linked by userid. The subreports are hardcoded for dates in the select menu.

I have the sales count and shared numbervar formula on the cal subreport. the main page of the report in in the history table. I placed the display formula in the footer of the date (sorts by month)
 
Here's some basic theory on the 3 formula method:

In the group header, supply a reset for the shared variable
whileprintingrecords;
shared numbervar MyValue:=0

In the subreport use:
whileprintingrecords;
shared numbervar MyValue:=<your formula>

Then in the group footer you can display/use the value:
whileprintingrecords;
shared numbervar MyValue;
MyValue

So the group footer could use whatever values are referenced in the main report at that level, including counts from the main report.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top