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

Shared variable issue (just wont go away :( )

Status
Not open for further replies.

cheerfulskeptic

Programmer
Feb 3, 2003
88
IN
ok, I have tried and tried, but to no avail. Once more, here's my code and I'm trying to be as specific as possible:

Report Description
Main Report: SQL Server
Subreport: Pervasive SQL Server
Due to linking issues, I had to create a subreport for the Pervasive part, and thats why I need to create shared variables

Groups:
group 1 - territory
group 2 - account (contains subreport for each account)

In main report header, formula initTerritoryCats

whileprintingrecords;
Global numbervar numCatsTerritoryJul := 0;

In subreport report footer:
formula @TotJul calculates totalled value is diff for each account

then in a section below the formula @TotJul, is a shared variable formula @sharedvarnumJul

whileprintingrecords;
shared numbervar numCatsTerritoryJul := shared numbervar numCatsTerritoryJul + {@TotJul};
numCatsTerritoryJul

this should be the running total from the subreport totals.

Now finally, in the group footer in main report, I have to print the final values of the shared variable numCatsTerritoryJul

so I have formula @totTerrJul
whileprintingrecords;
shared numbervar numCatsTerritoryJul;
numCatsTerritoryJul;

That does NOT work. give me very strange values. Sometimes they work, but if I play around with the report (ie, delete blank group footers, etc.) the numbers keep changing.
 
Why did you omit the formula for @Totjul? Otherwise we would have had it all.

Try writing formulas like this:

whileprintingrecords;
shared numbervar numCatsTerritoryJul;
numCatsTerritoryJul := numCatsTerritoryJul + {@TotJul};
numCatsTerritoryJul

Otherwise it seems OK.

-k
 
you are going to have to show us these weird numbers.

Show us what you get and what you expect to get. We cannot solve a problem based on our imagination...real data please.

Also Show us where the position of the subreport is...you give some information but it is not complete (ie. the EXACT position of the subreport in the main report...is it in the footer or header of Group 2)

In subreport report footer:
formula @TotJul calculates totalled value is diff for each account

then in a section below the formula @TotJul, is a shared variable formula @sharedvarnumJul

whileprintingrecords;
shared numbervar numCatsTerritoryJul := shared numbervar numCatsTerritoryJul + {@TotJul};
numCatsTerritoryJul



Why is @Totjul placed in the subreport footer???? What is the formula code?

ok, I have tried and tried, but to no avail. Once more, here's my code and I'm trying to be as specific as possible:

you have a ways to go before this is accomplished.

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top