Focal Point
Using SUM

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

May 19, 2006, 05:10 AM
Nitu Jain
Using SUM
Hi,

I am trying to get average using SUM verb as mentioned below code.

TABLE FILE CAR
SUM
AVE.SALES AS SAL1
BY
COUNTRY
END

TABLE FILE CAR
SUM
AVE.SALES AS SAL2
CNT.SALES
BY
COUNTRY
END

As a result I expect SAL1 and SAL2 should have same data in it but its not the case.

How can I achieve desire o/p using SUM?


WF dev version - 7.6.x
May 19, 2006, 10:28 AM
reFOCUSing
In 7.1.3 this works fine both are the same value. I remember having any like this in older versions, I think the problem was the records that had zero were not being used. ie Sales has the value of zero.

Are you getting results like the following:
Option 1:
		SALES	COUNT	AVE
ENGLAND		12000	4	3000
FRANCE		0	1	0
ITALY		30200	4	7550
JAPAN		78030	2	39015
W GERMANY	         88190	7	12598.57143
TOTAL		208420	18	11578.88889


Option 2:
		SALES	COUNT	AVE
ENGLAND		12000	1	12000
FRANCE		0	0	0
ITALY		30200	3	10066.66667
JAPAN		78030	2	39015
W GERMANY	         88190	7	12598.57143
TOTAL		208420	13	16032.30769

May 19, 2006, 12:10 PM
susannah
 
COUNTRY    SAL1 
ENGLAND    3000 
FRANCE        0 
ITALY      7550 
JAPAN     39015 
W GERMANY 12598 

COUNTRY   SAL2  SALES
                COUNT 
ENGLAND    3000 4 
FRANCE        0 1 
ITALY      7550 4 
JAPAN     39015 2 
W GERMANY 12598 7 

i get exactly the same answers




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
May 22, 2006, 02:52 AM
Nitu Jain
I get below output.

COUNTRY SAL1
======= =========
ENGLAND 3000
FRANCE 0
ITALY 7550
JAPAN 39015
W GERMANY 12598

PAGE 1
COUNTRY SAL2 SALES.COUNT
======= ==== =======
ENGLAND 3750 16
FRANCE 0 3
ITALY 0 4
JAPAN 39015 4
W GERMANY 7800 3

I am using web focus 7.1.1

Rgds.


WF dev version - 7.6.x
May 24, 2006, 02:39 AM
Piipster
I copied and pasted the two TABLE files into one focexec and they both returned the same answers for the AVE. This was running in Dev Studio R711.

Are you running them both from the same focexec.?
If not, can you try it?

It looks like something else is coming into play.


ttfn, kp


Access to most releases from R52x, on multiple platforms.
May 24, 2006, 03:49 AM
Tony A
ALso place -

? FILE CAR

as the final line of the fex and post the final comment from the page source. It should look something like -
<!--     
    
  0 STATUS OF FOCUS FILE: D:\wfdev\ibi\apps\...\car.foc ON 05/24/2006 AT 08.49.33
  0                 ACTIVE  DELETED    DATE OF    TIME OF    LAST TRANS
    SEGNAME         COUNT   COUNT      LAST CHG   LAST CHG     NUMBER
    
    ORIGIN             5             01/31/2005   10.34.23       53
    COMP              10             01/31/2005   10.34.23       53
    CARREC            18             01/31/2005   10.34.23       53
    BODY              18             11/25/2005   16.25.32         
    SPECS             18             01/31/2005   10.34.23       53
    WARANT             8             01/31/2005   10.34.23       53
    EQUIP             25             01/31/2005   10.34.23       53
    *INDEXES*
    COUNTRY                          01/31/2005   10.34.23       53
  0 TOTAL SEGS       102             
    TOTAL CHAR      3988
    TOTAL PAGES        8
    LAST CHANGE                      11/25/2005   16.25.32         
    
 -->


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 
May 24, 2006, 04:58 AM
Nitu Jain
Hi,

I got below info -

0 STATUS OF FOCUS FILE: C:\ibi\apps\baseapp\car.foc ON 05/24/2006 AT 14.21.41
0 ACTIVE DELETED DATE OF TIME OF LAST TRANS
SEGNAME COUNT COUNT LAST CHG LAST CHG NUMBER
ORIGIN 5 05/08/2006 12.25.53 53
COMP 10 05/08/2006 12.25.53 53
CARREC 18 05/08/2006 12.25.53 53
BODY 18 05/08/2006 12.25.53 53
SPECS 18 05/08/2006 12.25.53 53
WARANT 8 05/08/2006 12.25.53 53
EQUIP 25 05/08/2006 12.25.53 53
*INDEXES*
COUNTRY 05/08/2006 12.25.53 53
0 TOTAL SEGS 102
TOTAL CHAR 3988
TOTAL PAGES 8
LAST CHANGE 05/08/2006 12.25.53 53


I am running both of them from the same focexec.

Regards,


WF dev version - 7.6.x
May 24, 2006, 05:35 AM
Tony A
OK, so it looks as though your CAR file is intact with no modifications or updates. But as Karen has said, something else is coming into play.

Add

? JOIN
? SET

and again post the output but this time use the [ code ] and [ /code ] tags around your output so that it is easier to read Smiler (leave the spaces in the code tags out).



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 
May 24, 2006, 07:18 AM
Nitu Jain
Hi Tony, I am just trying to use code ... not sure if this is the correct way to use it.

  0 NO JOINS CURRENTLY IN EFFECT

 PARAMETER SETTINGS
 ALL.                OFF    FOCALLOC            OFF    PRINTPLUS           OFF
 ASNAMES           FOCUS    FOCSTACK SIZE         8    QUALCHAR              .
 AUTOINDEX            ON    FORMFEED          ASCII    QUALTITLES          OFF
 AUTOPATH             ON    HDAY                       REBUILDMSG         1000
 BINS                 64    HIPERFOCUS          OFF    RECAP-COUNT         OFF
 BLKCALC             NEW    HOLDATTRS         FOCUS    SAVEMATRIX          OFF
 BUSDAYS         _MTWTF_    HOLDLIST            ALL    SCREEN              OFF
 BYPANELING          OFF    HOLDSTAT            OFF    SHADOW PAGE         OFF
 CACHE                 0    HOTMENU             OFF    SPACES             AUTO
 CARTESIAN           OFF    IBMLE               OFF    SQLENGINE
 CDN                 OFF    INDEX TYPE          NEW    SUMPREFIX           LST
 COLUMNSCROLL        OFF    LANGUAGE      AMENGLISH    TCPIPINT            OFF
 DATEDISPLAY         OFF    LINES/PAGE           66    TEMP DISK C:\ibi\DEVS..
 DATEFNS              ON    LINES/PRINT          57    TERMINAL        IBM3270
 DATETIME  STARTUP/RESET    MESSAGE              ON    TESTDATE          TODAY
 DEFCENT              19    MODE              WINNT    TITLES               ON
 EMPTYREPORT         OFF    MORE                OFF    VIEWNAMESIZE         60
 EXCELRELEASE       2000    MULTIPATH      COMPOUND    WIDTH               130
 EXL2KLANG             1    NODATA                .    WINPFKEY            OLD
 EXTAGGR              ON    PAGE-NUM             ON    XFBINS     16 (passive)
 EXTHOLD              ON    PANEL                 0    XFC                  ON
 EXTSORT             OFF    PAUSE               OFF    XRETRIEVAL           ON
 FIELDNAME           NEW    POOL                OFF    YRTHRESH              0
 FOC2GIGDB            ON    PRINT            ONLINE
 



WF dev version - 7.6.x
May 24, 2006, 07:56 AM
Tony A
Apart from the fact that you are running in Dev Studio standalone server there is no difference to what I (and most others I assume) are running. I suugest you call this in.

By the way, spot on with the code tagging Smiler

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