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] COUNT and ACROSS - one pass report

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] COUNT and ACROSS - one pass report
 Login/Join
 
Expert
posted
This fex:

SET PAGE=NOLEAD
TABLE FILE GGSALES
SUM
COMPUTE SALES_LEVEL/A1 = IF DOLLARS LT 160000 THEN '1' ELSE IF DOLLARS GT 190000 THEN '3' ELSE '2';
ACROSS DATE AS ''
BY STCD

WHERE DATE IN (19960701, 19960801)
END

provides this result:
 1996/07/01 1996/08/01 
Store ID SALES_LEVEL SALES_LEVEL
-------- ----------- -----------
R1020    1           1
R1040    1           2
R1041    1           2
R1019    1           2
R1109    1           2
R1244    1           2
R1250    1           3
R1088    2           1
R1100    2           1
R1248    2           2
R1044    3           1
R1200    3           2

Is it possible to tweak the code to get this result in one pass:
Store Count SALES_LEVEL SALES_LEVEL
----------- ----------- -----------
          1 1           1
          5 1           2
          1 1           3
          2 2           1
          1 2           2
          1 3           1
          1 3           2


A count of the stores instead of the store ID's.

Thanks,

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


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
Virtuoso
posted Hide Post
I'll play around and see if I can figure out something, but at first glance, the issue I see is that you would have to sort on a computed column which is OK (BY TOTAL SALES_LEVEL) EXCEPT for the fact that I don't think you can use a BY TOTAL with an ACROSS in the same phrase, which throws out the possibility of a single pass.


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
Expert
posted Hide Post
Darin,

I don't mind if the result is not sorted - I'm having trouble calculating the store count column.

Thanks very much,


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
Virtuoso
posted Hide Post
Right - but in order to get the store count you would have to sum BY the sales level calculations. The BY is needed to get the store breakdown - not necessarily to perform any sorting. I think your only option is to hold your first request and then read the hold file and sort by the sales_level columns.


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
Expert
posted Hide Post
Darin, this is what I've concluded too. Thanks for looking into it for me.

Cheers,


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

Is the palcement of the columns important? If not try the code below and play with it
 
SET PAGE=NOLEAD
DEFINE FILE GGSALES
SALES_LEVEL/A1 = IF DOLLARS LT 16000 THEN '1' ELSE IF DOLLARS GT 19000 THEN '3' ELSE '2';
DATEA/A1=IF DATE EQ 19960701 THEN '1' ELSE IF DATE EQ 19960801 THEN '2' ELSE '';
STORECD/A10=SALES_LEVEL|'       '|DATEA;
END
TABLE FILE GGSALES
SUM 
     CNT.STCD
BY STORECD AS ''
 
WHERE DATE IN (19960701, 19960801)
END
 


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 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] COUNT and ACROSS - one pass report

Copyright © 1996-2020 Information Builders