Focal Point
[SOLVED] TOTAL row is wrong?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5567071296

December 17, 2019, 10:05 AM
Shingles
[SOLVED] TOTAL row is wrong?
Hey Folks,

I just noticed something strange on the TOTAL row of a tabular report. I have 5 columns in this report. The first is hidden for sorting purposes, the second is just textual, the others are all numbers. I show the total for those three number columns. The 3rd and 5th are fine, but the 4th is showing a negative number. It makes no sense, because there are no negative numbers in that column. Moreover, if I run it as an active report and calculate the sum for the 4th column (by left clicking the column and selecting Calculate > Sum), then it calculates it correctly. Any idea why the total row is showing a negative number? And the number doesn't seem to make sense either, like its not the correct sum multiplied by -1 either, just seems to be a random negative number.

Here is the code:
TABLE FILE COST_OF_CALLS
SUM
     CNT.DST.CALL_SOURCE_KEY/D12 AS 'Calls'
     COMPUTE RESPONSE_TIME/D9C = DIFSEC/60/60; AS 'Total,Hours'
     COST_ON_CALLS/D12M AS 'Cost of,Calls'
  BY TOTAL HIGHEST COST_ON_CALLS NOPRINT
  BY BY_DISPLAY AS '&BY_DISPLAY_TITLE'

WHERE MONTH_YEAR EQ '&MONTH_YEAR'
ON TABLE SUMMARIZE
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE PCHOLD FORMAT AHTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET LINES 700
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
GRAPHTYPE=DATA,
     COLUMN=N5,
$
TYPE=TITLE, COLUMN=N3, JUSTIFY=RIGHT,$
TYPE=TITLE, COLUMN=N4, JUSTIFY=RIGHT,$
TYPE=TITLE, COLUMN=N5, JUSTIFY=RIGHT,$
END


I realize you will not be able to run that code, sorry. But it might be helpful.

Also, in case this is important, the 4th column shows -579,182 on the TOTAL row. When I do Calculate > Sum, I get 613,871.


Thanks folks!

This message has been edited. Last edited by: Shingles,


WebFOCUS 8201, SP 0.1, Windows 7, HTML
December 17, 2019, 10:38 AM
Shingles
Might this be an overflow issue? Doesn't seem like the right way to deal with overflows though...


WebFOCUS 8201, SP 0.1, Windows 7, HTML
December 17, 2019, 11:19 AM
Shingles
NVM... it was an overflow issue. I moved the COMPUTE to a define and then things were great!


WebFOCUS 8201, SP 0.1, Windows 7, HTML
December 17, 2019, 11:48 AM
Waz
You know the difference between a COMPUTE and a DEFINE ?

COMPUTEs are evaluated after aggregation and sorting (but before TOTAL)
DEFINEs are evaluated at time of data retrieval.

This is important depending on the calculation you need.

So your DIFSEC field when calculated in a COMPUTE will be summed before the /60/60.

Also D fields are handled differently to other numeric fields like P fields.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

December 17, 2019, 03:35 PM
Shingles
Yes, I was aware... just forgot.


WebFOCUS 8201, SP 0.1, Windows 7, HTML
December 17, 2019, 04:17 PM
Waz
I know what you mean.

So much to remember. Smiler


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

December 17, 2019, 04:34 PM
Shingles
I did remember in the end though... anyways... thanks Waz!


WebFOCUS 8201, SP 0.1, Windows 7, HTML
December 18, 2019, 03:33 AM
Tony A
Could any of your DIFSEC values be nulls?

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10