Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Sum a field value at header level or subhead level

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Sum a field value at header level or subhead level
 Login/Join
 
Member
posted
Hi,

How to sum the ETAEXP field value and print the sum in the heading

I have pasted the FEX code below for reference

Thanks in Advance,

 SET HTMLARCHIVE=OFF
SET PAGE-NUM = NOPAGE
-SET &ECHO=ALL;
-BEGINN
-SET &STARTTIME = '12:00:00';
-SET &ENDTIME = '24:00:00';
-SET &TIME = EDIT(HHMMSS('A8'),'99$:99$:99');
-SET &TIMETEXT = IF ((&TIME GE &STARTTIME ) AND (&TIME LE &ENDTIME )) THEN ' TIME:   ' | &TIME | ' PM' ELSE ' TIME:    ' | &TIME | ' AM';
-SET DATETIME=NOW;
SET FOCFIRSTPAGE= 1
-RUN
DEFINE FILE CSR_TM_ERR

TODAY/A8 = '&DATEMDY';
DTDESC/A30 = 'DATE:    ' | TODAY;

JULDATE/I5L = (ETOODT - 100000);
JDATE/I7 = JULDATE + 2000000 ;
GREG_DATE/I8 = GREGDT(JDATE, 'I8');
NEW_DATE/DMYYWT = DATECVT(GREG_DATE, 'I8YYMD', 'DMYYWT');

JULDATE/I5L = (ETIVD - 100000);
JDATE/I7 = JULDATE + 2000000 ;
GREG_DATE/I8 = GREGDT(JDATE, 'I8');
NEW_DATE1/DMYYWT = DATECVT(GREG_DATE, 'I8YYMD', 'DMYYWT');

TMBR/A60 = 'Team Member:   ' | ETUSER ;
TORD/A6 = FTOA(TOTORDERS,'(D5)', TORD);
TORDDESC/A40 = 'Total Orders Taken:   ' | TORD;
TLINE/A6 = FTOA(TOTLINES,'(D5)', TLINE);
TLINEDESC/A40 = 'Total Lines Taken:   ' | TLINE;

TERRDESC/A40 = 'Total # Of Errors:';
ERRDESC/A40 = 'Error % (Ln):';
TAMTDESC/A40 = 'Amount $ Lost:';
ORDESC/A12 = 'Original' ;
CRDESC/A15 = 'WRONG SIZE';
CRDDESC/A20 = IF ( ETEDES EQ CRDESC ) THEN 'N/C' ELSE 'Credit';
ETOPRCDOL/D8.2CM = ETOPRC;
ETAEXDOL/D8.2CM = ETAEXP;



-*ETAAE/I5 = 0;
-*TOTAEXP/D8.2CM = IF (CPUSER EQ ETUSER) THEN SUM. ETAEXP ELSE ETAAE EQ 0;


SHEAD1/A10 = 'Order #';
SHEAD2/A10 = 'Item #';
SHEAD3/A3 = 'Qty';
SHEAD4/A2 = 'Ln';
SHEAD5/A15 = 'Description';
SHEAD6/A10 = '$ Amount';
SHEAD7/A10 = 'Route';
SHEAD8/A5 = 'Date';
SHEAD9/A25 = 'Reason / (corrected by)';
SHEAD10/A20 = 'Error Count Code';
SPACE1/A1 = '' ;

MLINE1/A20 = '-----------';   
MLINE2/A20 = '-----------';
MLINE3/A20 = '-------';
MLINE4/A20 = '-----';
MLINE5/A30 = '-------------------';
MLINE6/A20 = '------------';
MLINE7/A20 = '----------';
MLINE8/A30 = '-----------------';
MLINE9/A40 = '------------------------';
MLINE10/A30 = '-----------------';   
ETCOTKDESC/A30 = '('| ETCOTK |')';

END
SET PRINTPLUS=ON
TABLE FILE CSR_TM_ERR
PRINT  
                    
                         ORDESC AS '' IN 1
                         ETODOC AS '' IN 7
                         ETOITM AS '' IN 16
                          ETOQSH AS '' IN 19
                          ETOUOM AS '' IN 23
                          IMDSC1 AS '' IN 34
                          ETOPRCDOL AS '' IN 50
                          ETORT AS '' IN 60
                          NEW_DATE AS '' IN 66
                          ETEDES AS '' IN 78
                          SPACE1 AS '' IN 90 OVER
                 CRDDESC AS '' IN 1 
	         ETDOCO AS '' IN 7   
		ETLITM AS '' IN 16
		ETSOQS AS '' IN 19
		ETUOM AS '' IN 23
                 IMDSC1 AS '' IN 34
		ETAEXDOL AS '' IN 50
        		ETROUT AS '' IN 60
		NEW_DATE1 AS '' IN 66
	        ETCOTKDESC AS '' IN 78
	        ETCCDE AS '' IN 90 
       COMPUTE ETAAE/D8.2CM = ETAEXP; NOPRINT     
        
BY ETUSER NOPRINT

WHERE (CSR_TM_ERR.INPUT.PDATE EQ &PDATE.(<108125,108125>).Pdate:.)
AND (CSR_TM_ERR.INPUT.PLIBRARY EQ '&PLIBRARY.(<USAPROD,USAPROD>).Plibrary:.');
HEADING
"<DTDESC<+0>"
"&TIMETEXT<+0>"
"Week Ending &DATE_TEXT"
" "
"<TMBR<+0><TERRDESC"
"<TORDDESC<+0><ERRDESC"
"<TLINEDESC<+0><TAMTDESC<+0><[B]ETAEXP[/B]"
" "
" "
"<SHEAD1<+0><SHEAD2<+0><SHEAD3<+0><SHEAD4<+0><SHEAD5<+0><SHEAD6<+0><SHEAD7<+0><SHEAD8<+0><SHEAD9<+0><SHEAD10"
"<MLINE1<+0><MLINE2<+0><MLINE3<+0><MLINE4<+0><MLINE5<+0><MLINE6<+0><MLINE7<+0><MLINE8<+0><MLINE9<+0><MLINE10"
" "     
                
ON TABLE SET PAGE-NUM OFF

ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON ETUSER PAGE-BREAK
ON TABLE SET STYLE *
    UNITS=IN,
    ORIENTATION=LANDSCAPE,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='TIMES NEW ROMAN',
     SIZE=8,
$
TYPE=HEADING,
     LINE=1,
     ITEM=1,
     OBJECT=FIELD,
     BACKCOLOR='WHITE',
     STYLE=BOLD,
     JUSTIFY=LEFT,POSITION='N1', 
$
TYPE=HEADING,
     LINE=1,
     ITEM=1,
     OBJECT=TEXT,
     BACKCOLOR='WHITE',
     STYLE=BOLD,
     JUSTIFY=CENTER,POSITION='N9',
$
TYPE=HEADING,
     LINE=2,
     ITEM=1,
     OBJECT=FIELD,
     BACKCOLOR='WHITE',
     STYLE=BOLD,
     JUSTIFY=LEFT, POSITION='N1',
$
TYPE=HEADING,
     LINE=2,
     ITEM=2,
     OBJECT=TEXT,
     BACKCOLOR='WHITE',
     STYLE=BOLD,
     JUSTIFY=CENTER, POSITION='N9',
$
TYPE=HEADING,
     LINE=3,

     OBJECT=TEXT,
     BACKCOLOR='WHITE',
     STYLE=BOLD,
     JUSTIFY=CENTER,POSITION='N9', 
$
TYPE=HEADING,
     LINE=5,
     ITEM=1,
     OBJECT=FIELD,
     BACKCOLOR='WHITE',
     STYLE=BOLD,
     JUSTIFY=LEFT,POSITION='N1', 
$
TYPE=HEADING,
     LINE=5,
     ITEM=2,
     OBJECT=FIELD,
     BACKCOLOR='WHITE',
     STYLE=BOLD,
     JUSTIFY=RIGHT,POSITION='N12', 
$
TYPE=HEADING,
     LINE=6,
     ITEM=1,
     OBJECT=FIELD,
     BACKCOLOR='WHITE',
     STYLE=BOLD,
     JUSTIFY=LEFT,POSITION='N1', 
$
TYPE=HEADING,
     LINE=6,
     ITEM=2,
     OBJECT=FIELD,
     BACKCOLOR='WHITE',
     STYLE=BOLD,
     JUSTIFY=RIGHT,POSITION='N12', 
$
TYPE=HEADING,
     LINE=7,
     ITEM=1,
     OBJECT=FIELD,
     BACKCOLOR='WHITE',
     STYLE=BOLD,
     JUSTIFY=LEFT,POSITION='N1', 
$
TYPE=HEADING,LINE=7, ITEM=2, OBJECT=FIELD, BACKCOLOR='WHITE', STYLE=BOLD, JUSTIFY=RIGHT,POSITION='N12',$

TYPE=HEADING,LINE=10, ITEM=1, OBJECT=FIELD, POSITION='N5',BACKCOLOR='WHITE', STYLE=BOLD,  $
TYPE=HEADING,LINE=10, ITEM=2, OBJECT=FIELD, POSITION='N6',BACKCOLOR='WHITE', STYLE=BOLD, $
TYPE=HEADING,LINE=10, ITEM=3, OBJECT=FIELD, POSITION='N7',BACKCOLOR='WHITE', STYLE=BOLD, $
TYPE=HEADING,LINE=10, ITEM=4, OBJECT=FIELD, POSITION='N8',BACKCOLOR='WHITE', STYLE=BOLD, $
TYPE=HEADING,LINE=10, ITEM=5, OBJECT=FIELD, POSITION='N9',BACKCOLOR='WHITE', STYLE=BOLD,$
TYPE=HEADING,LINE=10, ITEM=6, OBJECT=FIELD, POSITION='N10',BACKCOLOR='WHITE', STYLE=BOLD, $
TYPE=HEADING,LINE=10, ITEM=7, OBJECT=FIELD, POSITION='N11',BACKCOLOR='WHITE', STYLE=BOLD, $
TYPE=HEADING,LINE=10, ITEM=8, OBJECT=FIELD, POSITION='N12',BACKCOLOR='WHITE', STYLE=BOLD,$
TYPE=HEADING,LINE=10, ITEM=9, OBJECT=FIELD, POSITION='N13',BACKCOLOR='WHITE', STYLE=BOLD, $
TYPE=HEADING,LINE=10, ITEM=10, OBJECT=FIELD, POSITION='N14',BACKCOLOR='WHITE', STYLE=BOLD,JUSTIFY=LEFT, $

TYPE=HEADING,LINE=11, ITEM=1, OBJECT=FIELD, POSITION='N5',BACKCOLOR='WHITE', STYLE=BOLD, $
TYPE=HEADING,LINE=11, ITEM=2, OBJECT=FIELD, POSITION='N6',BACKCOLOR='WHITE', STYLE=BOLD,$
TYPE=HEADING,LINE=11, ITEM=3, OBJECT=FIELD, POSITION='N7',BACKCOLOR='WHITE', STYLE=BOLD, $
TYPE=HEADING,LINE=11, ITEM=4, OBJECT=FIELD, POSITION='N8',BACKCOLOR='WHITE', STYLE=BOLD, $
TYPE=HEADING,LINE=11, ITEM=5, OBJECT=FIELD, POSITION='N9',BACKCOLOR='WHITE', STYLE=BOLD, $
TYPE=HEADING,LINE=11, ITEM=6, OBJECT=FIELD, POSITION='N10',BACKCOLOR='WHITE', STYLE=BOLD, $
TYPE=HEADING,LINE=11, ITEM=7, OBJECT=FIELD, POSITION='N11',BACKCOLOR='WHITE', STYLE=BOLD, $
TYPE=HEADING,LINE=11, ITEM=8, OBJECT=FIELD, POSITION='N12',BACKCOLOR='WHITE', STYLE=BOLD,$
TYPE=HEADING,LINE=11, ITEM=9, OBJECT=FIELD, POSITION='N13',BACKCOLOR='WHITE', STYLE=BOLD,$
TYPE=HEADING,LINE=11, ITEM=10, OBJECT=FIELD, POSITION='N14',BACKCOLOR='WHITE', STYLE=BOLD,JUSTIFY=LEFT, $


ENDSTYLE
END
-* End Report Assistant





Thanks,
Prasad

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


7.6.4
Windows PDF, HTML, AHTML, EXCEL
 
Posts: 5 | Registered: April 03, 2008Report This Post
Expert
posted Hide Post
Do a multi-verb request then hold all the data then report off of it. The sum by user is then available as a field in the hold file and can be put in the heading.

SET ASNAMES=ON
TABLE FILE ...
SUM ETAEXP AS TOT_ETAEXP
BY ETUSER
PRINT ....
BY ETUSER
ON TABLE HOLD FORMAT ALPHA
END
TABLE FILE HOLD
....
END  


Now you can put TOT_ETAEXP in the heading.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Virtuoso
posted Hide Post
Prasadbollam,

You can use the TOT prefix operator as follows:
  
TABLE FILE CAR
PRINT SALES
BY COUNTRY
HEADING
"Total Sales:<TOT.SALES "
END


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Member
posted Hide Post
Hi GJ,

Thanks GinnyJakes for the quick reply.

I am able to print the sum in header with your solution.

Thanks,
Prasad


7.6.4
Windows PDF, HTML, AHTML, EXCEL
 
Posts: 5 | Registered: April 03, 2008Report This Post
Member
posted Hide Post
Hi Daniel,

Thanks Daniel for the quick reply,

TOT prefix operator is printing the whole sum of sales, not printing BY COUNTRY sales


Thanks,
Prasad


7.6.4
Windows PDF, HTML, AHTML, EXCEL
 
Posts: 5 | Registered: April 03, 2008Report This Post
Virtuoso
posted Hide Post
Prasadbollam,

Sorry, I didn't notice the PAGE-BREAK on your BY field. So Ginny's solution is the correct one but you don't need to use a hold file.
  
TABLE FILE CAR
SUM SALES NOPRINT
BY COUNTRY
PRINT SALES
BY COUNTRY PAGE-BREAK
HEADING
"Total Sales for <COUNTRY is:<SALES "
END

This because in the HEADING, Focus will use the highest occurence of the field SALES which is summed by COUNTRY.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Guru
posted Hide Post
quote:
TABLE FILE CAR
SUM SALES NOPRINT
BY COUNTRY
PRINT SALES
BY COUNTRY PAGE-BREAK
HEADING
"Total Sales for END

How do we format if we have a heading like
Please help....
 
Posts: 289 | Location: Houston,TX | Registered: June 11, 2004Report This Post
Expert
posted Hide Post
Please always put your code between
[code]
[/code]
tags.

I assume your HEADING contains the SALES field.

TABLE FILE CAR
SUM SALES NOPRINT
BY COUNTRY
PRINT SALES
BY COUNTRY PAGE-BREAK
HEADING
"TOTAL SALES FOR <COUNTRY|: <SALES"

ON TABLE SET STYLE *
TYPE=HEADING, STYLE=BOLD, $
TYPE=HEADING, LINE=1, COLOR=NAVY, $
TYPE=HEADING, LINE=1, ITEM=2, COLOR=RED, $
TYPE=HEADING, LINE=1, ITEM=4, COLOR=GREEN, $
END


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Guru
posted Hide Post
So sorry, I just wanted to see how can we format a field in the heading when we display the totals
 
HEADING
"COUNTRY: <TOT.SALES"
 

In my table I have a number that cuts off with **** and i'm unable to format in the heading..

Please help..
 
Posts: 289 | Location: Houston,TX | Registered: June 11, 2004Report This Post
Virtuoso
posted Hide Post
That means your field is not set wide enough to accomodate the total value. Since you do not have controlover the format when it is displayed in the heading (focus just takes the format of the field and that's it), you would have to create a define field that is large enough to hold the total, equate it to sales, and use that in the subsequent report.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Guru
posted Hide Post
GamP,
Thanks so much..I will try that and see..

I love this forum...always have answers for everyone..
 
Posts: 289 | Location: Houston,TX | Registered: June 11, 2004Report This Post
Expert
posted Hide Post
TABLE FILE CAR
SUM
COMPUTE TSALES/D10 = SALES; NOPRINT
PRINT SALES
BY COUNTRY PAGE-BREAK
HEADING
"TOTAL SALES FOR COUNTRY: <TSALES"

ON TABLE SET STYLE *
TYPE=HEADING, STYLE=BOLD, $
TYPE=HEADING, LINE=1, COLOR=NAVY, $
TYPE=HEADING, LINE=1, ITEM=2, COLOR=RED, $
END


or

DEFINE FILE CAR
SALESD/D10 = SALES;
END
TABLE FILE CAR
PRINT 
SALES
BY COUNTRY PAGE-BREAK
HEADING
"TOTAL SALES FOR COUNTRY: <TOT.SALES <TOT.SALESD"

ON TABLE SET STYLE *
TYPE=HEADING, STYLE=BOLD, $
TYPE=HEADING, LINE=1, COLOR=NAVY, $
TYPE=HEADING, LINE=1, ITEM=2, COLOR=RED, $
END



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Sum a field value at header level or subhead level

Copyright © 1996-2020 Information Builders