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

Crystal footer error

Status
Not open for further replies.

FinalPrime

Technical User
Jul 28, 2003
50
US
In a group footer, I have code in a formula (let's call it Fx) that uses (as its variables), output from running totals for that group.

In all cases, the Fx value returned is correct if 'Details-hide-Drill-Down' is Unchecked (not used)

When 'Details-hide-Drill-Down' is checked (used), Fx values are incorrect when the print line is the

first line of the page. All other Fx on the page are correct.

However, when 'Details-hide-Drill-Down' is Checked (used) , AND the Group-footer-section 'new page before'

is checked (used), all Fx are correct (gets only one print line per page.)

One Crystal web site article discusses incorrect sub-total; its n/a.

Does anyone have any cause-effect-resolution as to whats going on.


Any insight is greatly appreciated.

finalprime
 
Please post your formulas. Also, are you using shared variables from a subreport? Please be advised that a subreport in a suppressed section will not execute, and therefore any formula using shared variables with data from the subreport will return incorrect data.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
I'm not using a sub-report.

Below is a "portion" of the Fx function. The amount of code is extensive, but the jest of the pattern repeats until all 3-digit identifiers are added to the final value (foot). ( There are over 20 3-digit items to be checked out and summed: 'OSF, BAS , OSS, etal)

NumberVar foot;
Numbervar dummy;
NumberVar muchwork;
NumberVar morework;
NumberVar skiping;
//////////////////
///////BAS is complete:
dummy := 0; muchwork := 0 ; foot := 0 ; morework := 0 ; skiping :=0 ;
If IsNull({#BAS_unique_additions}) = true then
muchwork := 1
else muchwork := {#BAS_unique_additions} ;
If muchwork < 1 then
muchwork := 1
else
dummy := 0 ;
If {#BAS_count} > 0 then
dummy := (( {#BAS_sf_sum} / {#BAS_count} ) * muchwork)
else
dummy := 0;
foot := foot + dummy ;
/////////////////
///////ATC is complete:
dummy := 0; muchwork := 0 ;
If IsNull({#ATC_unique_additions}) = true then
muchwork := 1
else muchwork := {#ATC_unique_additions} ;
If muchwork < 1 then
muchwork := 1
else
dummy := 0 ;
If {#ATC_count} > 0 then
dummy := (( {#ATC_sf_sum} / {#ATC_count} ) * muchwork)
else
dummy := 0;
foot := foot + dummy ;
///\\\\\\\\\\\\\\\\\\\\\\\/////////////////
///////BAY is complete:
dummy := 0; muchwork := 0 ;
If IsNull({#BAY_unique_additions}) = true then
muchwork := 1
else muchwork := {#BAY_unique_additions} ;
If muchwork < 1 then
muchwork := 1
else
dummy := 0 ;
If {#BAY_count} > 0 then
dummy := (( {#BAY_sf_sum} / {#BAY_count} ) * muchwork)
else
dummy := 0;
foot := foot + dummy ;
///\\\\\\\\\\\\\\\\\\\\\\\so on a so forth.

finalprime
 
All formulas using variables whould be prefaced with a line of code:

WhilePrintingRecords;

Have you done this?

Also, why are you using variables at all? Can oyu not just add your 2 sums together then multiply by {#ATC_unique_additions} ?



Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
dgillz,

I have not preceded formula (using variables) with 'WhilePrintingRecords'; I'll certainly do that.

I will also dig into Crystal some more and understand the 'why' behind it and the reason it only affects the first value at the top of each page.

No doubt, I've got more to learn.

As to the need to use variables in the first place, I'll explain by way of example of rows returning.

Code-----Id---------Units--------
row-data ATC 1 1,000
row-data ATC 1 1,000
row-data ATC 1 1,000
row-data ATC 2 50
row-data ATC 2 50
row-data BAY 3 2,000


Fx = 1,000 + 50 + 2000 = 3,050 is the correct answer.
stated another way:
Fx = (3,000 / 3 ) + (100 / 2 ) + (2,000 / 1 ) = 3050

Its clear the formula I furnished is not correct and that’s my next problem to solve. If I did it this way:

Fx = ( #ATC_sf_Sum# / #ATC_unique_additions#)
Fx := Fx + (#BAY_sf_Sum# / #BAY_unique-additons)

I'd get ( 3100 / 5 ) + (2,000 / 1 ) = 620 + 2,000 = 2,600

Which is also incorrect since I'm adding two averages of the ATC and BAY.

At this point I cannot figure out how to get the 3050 either with or without formula.

I'm collecting data for the 20 germane codes by way of Running-totals, but have no way to collect data correctly (in Running-Totals) because of the darn varying number of multiple repeats of the same codes with varying number of units.

With much appreciation,

FinalPrime
 
your numeric example is a bit weird.

Code-------Id-----------Units--------
row-data ATC 1 1,000
row-data ATC 1 1,000
row-data ATC 1 1,000
row-data ATC 2 50
row-data ATC 2 50
row-data BAY 3 2,000

Are you getting duplicate records?

Could the result for ID = 1 be 500,1000,700 respectively?

OR Do you want simply the last value of an ID for a giving code to be added together....

If these are duplicates then the duplication must be cleaned up

If you want the last value of an ID for a given code then do a manual addition in the ID footer

Otherwise...I don't understand the AVGERAGing purpose

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Using your example, you would get a result of 3050 if you used the running total expert and selected {table.unit}, sum, evaluate on change of field-> choose {table.ID}. Reset never. It seems as though you might be taking a more complicated approach than necessary.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top