I am doing the following Table File Request and need to limit the number of records to the first 5 records each time the clno changes (each unique clno). Thanks.
TABLE FILE HOLDFILE SUM PAYMENTS BY CLNO PAGE-BREAK REPAGE NOPRINT BY DESCRIPTION END
Windows Operating System WF Developer Studio 8009This message has been edited. Last edited by: Michele Brooks,
July 06, 2015, 10:56 AM
Francis Mariani
If DESCRIPTION is the "differentiator" field, then BY LOWEST 5 DESCRIPTION might work...
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
July 06, 2015, 06:18 PM
Waz
If any of the other BY HIGHEST/LOWEST don't work, then COMPUTE a counter and use WHERE TOTAL counter LE 5.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
July 06, 2015, 10:18 PM
Michele Brooks
Lowest 5 will only give me the lowest 5 for the first clno only. Thank you for your suggestion. I figured out the following solution. This solution will start the list count with 1 every time the clno changes. This allows me to capture the first 5 records for each unique clno.
TABLE FILE HOLD1
LIST *
BY CLNO PAGE-BREAK REPAGE
ON TABLE HOLD AS HOLD2 FORMAT ALPHA
END
DEFINE FILE HOLD2
RECORD_COUNT/I5 = LIST;
END
TABLE FILE HOLD2
SUM
BY CLNO PAGE-BREAK REPAGE NOPRINT
WHERE RECORD_COUNT LE 5
END
WF 8205, Windows 10 Oracle DBMS EXL07/PDF Output
July 07, 2015, 10:08 AM
Francis Mariani
Michelle, because there is a BY statement before the BY LOWEST you should get 5 rows for every CLNO.
This seems to work:
SET BYDISPLAY=ON
TABLE FILE GGPRODS
SUM
SIZE
BY PACKAGE_TYPE
BY LOWEST 3 PRODUCT_DESCRIPTION
END
Package Product Size
------- -------------- ----
Case Biscotti 24
Case Coffee Grinder 12
Case Coffee Pot 8
Pounds French Roast 12
Pounds Hazelnut 16
Pounds Kona 12
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
July 07, 2015, 12:45 PM
George Patton
That's nice Michelle. I didn't know that you could use LIST as a variable name afte using it as a command. I wonder if RANKED BY works the same ...