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     [Solved] Why numeric sort field being aggregated on heading?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[Solved] Why numeric sort field being aggregated on heading?
 Login/Join
 
Guru
posted
My report is sorted by salesman# and I give the subtotals and a page-break for each salesman#. I used the same sort field on the heading, but it displayed the sum of salesman# of the current page. Have anyone experienced this before? How can I do it properly? Thanks.

 TABLE FILE H_FINAL
SUM 
     'H_FINAL.SEG01.AFAKNA' AS 'Name'
     'H_FINAL.SEG01.BALANCE' AS 'Total Past Due'
BY 'H_FINAL.SEG01.SLSNO' NOPRINT                                  <==== sort field
BY 'H_FINAL.SEG01.CUSTOMER' AS 'Customer'
PRINT 
     'H_FINAL.SEG01.ARALNB' AS 'Invoice#/,Cash txn#'
     'H_FINAL.SEG01.ARH6CD' AS 'Type'
     'H_FINAL.SEG01.INV_DATE' AS 'Invoice/,payment,Date'
     'H_FINAL.SEG01.TXNAMT' AS 'Invoice/,Payment,Amount'
     'H_FINAL.SEG01.DUE_DATE' AS 'Due Date'
     'H_FINAL.SEG01.BALANCE' AS 'Outstanding ,Amount'
BY 'H_FINAL.SEG01.SLSNO' NOPRINT                                  <==== sort field
BY 'H_FINAL.SEG01.CUSTOMER' AS 'Customer'
     
ON H_FINAL.SEG01.SLSNO SUBTOTAL
     TXNAMT
     BALANCE MULTILINES AS 'Total for Salesrep'
ON H_FINAL.SEG01.SLSNO PAGE-BREAK REPAGE
     
ON H_FINAL.SEG01.CUSTOMER UNDER-LINE
HEADING
"Past Due Receivables by Salesman as of <+0>&DATE"
"SalesRep   - <H_FINAL.SEG01.SLSNO  - <H_FINAL.SEG01.SLSNM "       <==== sum of SLSNO displayed
" "
FOOTING BOTTOM
"Page <TABPAGENO "
ON TABLE SUBFOOT
"********* End of Report *********"
" "
ON TABLE SET EMPTYREPORT ANSI
ON TABLE SET PAGE-NUM OFF 
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT &WFFMT.(<HTML,HTML>,<PDF,PDF>,<Excel 2000,EXL2K>).Select type of display output.  

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


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
 
Posts: 305 | Location: Winnipeg,MB | Registered: May 12, 2008Report This Post
Virtuoso
posted Hide Post
You have...
TABLE FILE H_FINAL
SUM 
     'H_FINAL.SEG01.AFAKNA' AS 'Name'
     'H_FINAL.SEG01.BALANCE' AS 'Total Past Due'
BY 'H_FINAL.SEG01.SLSNO' NOPRINT                                  <==== sort field
BY 'H_FINAL.SEG01.CUSTOMER' AS 'Customer'
PRINT 
...
BY 'H_FINAL.SEG01.SLSNO' NOPRINT                                  <==== sort field
BY 'H_FINAL.SEG01.CUSTOMER' AS 'Customer'
...
ON H_FINAL.SEG01.SLSNO PAGE-BREAK REPAGE
     
HEADING
"Past Due Receivables by Salesman as of <+0>&DATE"
"SalesRep   - <H_FINAL.SEG01.SLSNO  - <H_FINAL.SEG01.SLSNM "       <==== sum of SLSNO displayed
" "
...



IIRC, fields imbedded in the heading text are (if necessary) added as Noprint verb objects to the first verb. In your case, the first verb has two BY phrases; so SLSNO will be "summarized" over all the distinct Customers within each SLSNO value, and you wind up with (number of Cust's) x (slsno value).

Try it with three verbs, so that the top verb is sorted only by the page-break column:
TABLE FILE H_FINAL

SUM 
     'H_FINAL.SEG01.SLSNM' NOPRINT
BY 'H_FINAL.SEG01.SLSNO' NOPRINT                                  

SUM 
     'H_FINAL.SEG01.AFAKNA' AS 'Name'
     'H_FINAL.SEG01.BALANCE' AS 'Total Past Due'
BY 'H_FINAL.SEG01.SLSNO' NOPRINT                                  
BY 'H_FINAL.SEG01.CUSTOMER' AS 'Customer'

PRINT 
...
BY 'H_FINAL.SEG01.SLSNO' NOPRINT                                  
BY 'H_FINAL.SEG01.CUSTOMER' AS 'Customer'
...


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
Also, to have the SLSNO field in the heading to really represent the data, shouldn't you have a page break for every SLSNO?


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
Jack,

Thank you for explaining what is happening with the embedded fields on headings. But it is still behaving the same with your sugguestion.
quote:
you wind up with (number of Cust's) x (slsno value).


I tried a few other ways, and it only works if there is no "SUM" verbs and have the total outstanding amounts as the subtotal at cus# level. Or if I really wanted the original layout, I have to change SLSNO to alpha field to display on the heading.


Francis, Yes I have a page-break on SLSNO.


Thanks,


Hua


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
 
Posts: 305 | Location: Winnipeg,MB | Registered: May 12, 2008Report This Post
Virtuoso
posted Hide Post
Try computing a field in the first verb set to be the max value and use that field in your heading.
COMPUTE SLSNO_MAX/format=MAX.SLSNO;
and
HEADING
"SalesRep   - <SLSNO_MAX  "


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Virtuoso
posted Hide Post
Hua,
In a similar situation in the past I had solved this by coding it like this:
"SalesRep   - <FST.SLSNO  - <H_FINAL.SEG01.SLSNM "

Maybe this is also a solution in this case?


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Virtuoso
posted Hide Post
Gerard,

In this case, since the lowest level verb is PRINT there is no problem. However, if it were SUM, then using FST. is fine if the file is not a RDBMS. If it is, then one should use MIN or MAX or AVE, otherwise aggregation will not be done.


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
Master
posted Hide Post
Another option is to convert the SALESNO to an alpha and sort/sum on that.
DEFINE MYFILE
SALESNO_A/A9=EDIT(SALESNO);
END
SUM
'H_FINAL.SEG01.AFAKNA' AS 'Name'
'H_FINAL.SEG01.BALANCE' AS 'Total Past Due'
BY SALESNO_A NOPRINT <==== sort field
BY 'H_FINAL.SEG01.CUSTOMER' AS 'Customer'
PRINT
...
BY SALESNO_A NOPRINT <==== sort field
BY 'H_FINAL.SEG01.CUSTOMER' AS 'Customer'
...
ON SALESNO_A PAGE-BREAK REPAGE

HEADING
"Past Due Receivables by Salesman as of <+0>&DATE"
"SalesRep - " "


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report This Post
Guru
posted Hide Post
I see that the possibilities are unlimited. Thanks to all of you!

Hua


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
 
Posts: 305 | Location: Winnipeg,MB | Registered: May 12, 2008Report This Post
Virtuoso
posted Hide Post
quote:
But it is still behaving the same with your sugguestion.


My suggestion would work if reporting from a hierarchical file (multiple-segment Focus file) with SLSNO as the root segment's key. From a flat file, you'll get (SLSNO key value) x (number of incoming row instances with that value).

Changing it to an Alpha field (in a DEFINE, not a compute!) is the way to go.


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Guru
posted Hide Post
Jack,

I've always appreciated you for answering "why" it happenned.
For the sake of discussion, I have observed that any embeded field in heading, will be summarized as long as there is a summation verb that
alpha field = last occurence of the current group
numeric field = value x # ocurrence of the current group.

DEFINE FILE CENTGL
Mylevel/I5=CENTGL.ACCOUNTS.GL_ACCOUNT_LEVEL +1;
END
TABLE FILE CENTGL
SUM
     'CNT.CENTGL.ACCOUNTS.GL_ACCOUNT_LEVEL'
BY 'CENTGL.ACCOUNTS.Mylevel'
PRINT
     'CENTGL.ACCOUNTS.GL_ACCOUNT'
     'CENTGL.ACCOUNTS.GL_ROLLUP_OP'
     'CENTGL.ACCOUNTS.GL_ACCOUNT_CAPTION'
     'CENTGL.ACCOUNTS.SYS_ACCOUNT'
BY 'CENTGL.ACCOUNTS.Mylevel'
BY 'CENTGL.ACCOUNTS.GL_ACCOUNT_PARENT'
BY 'CENTGL.ACCOUNTS.GL_ACCOUNT_TYPE'
HEADING
"My level = <CENTGL.ACCOUNTS.Mylevel , parent =<CENTGL.ACCOUNTS.GL_ACCOUNT_PARENT "
FOOTING
""
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
END  



Hua

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


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
 
Posts: 305 | Location: Winnipeg,MB | Registered: May 12, 2008Report 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     [Solved] Why numeric sort field being aggregated on heading?

Copyright © 1996-2020 Information Builders