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.
Is the table an RDBMS table? Does the "last" mean the highest values based on a sort (hopefully indexed) column?
This might be of help:
TABLE FILE BASEL_TIME_D
SUM MIN.TIME_DIM_KEY
BY HIGHEST TIME_DIM_KEY
WHERE READLIMIT EQ 10
END
The generated SQL:
SELECT
T1.TIME_DIM_KEY,
MIN(T1.TIME_DIM_KEY)
FROM
BASEL.TIME_D T1
GROUP BY T1.TIME_DIM_KEY
ORDER BY
T1.TIME_DIM_KEY DESC
FETCH FIRST 10 ROWS ONLY FOR FETCH ONLY;
The combination of "DESC" (descending) and "FETCH FIRST 10 ROWS" shpuld give you the 10 highest rows based on the sort column.
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
The DB does not need to be presorted in descending order to use WHERE READLIMIT EQ # - the sort is done first and then only # rows are returned to WebFOCUS.
When using BY HIGHEST #, the sort is done and all rows are returned to WebFOCUS which selects the first # returned rows for the report - quite a bit less efficient than the other method.
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
I have a bit of a challenge with the suggested methods.
The table in question is a FOC repository - BOTLOG2 which does not have a timestamp or any field I can use as index. I think RC stopped recording to the BOTLOG2 at some point and that's why I want to retrieve the last 10 records.
If you join BOTLOG to BOTLOG2, you will have a datetime stamp to look at. It is in GMT and there are lots of posts on it.
The other thing you can look at is the STAT_BT_NAME field. It is assigned in order so that the next one is higher than the previous one. That would allow you to do the BY HIGHEST 10 STAT_BT_NAME. Check it out.
I'm not sure if you can do this in less steps, but here's an example:
-*-- Display last 10 rows of a non-indexed FOCUS database
SET COUNTWIDTH = ON
TABLE FILE BOTLOG2
COUNT STAT_BT_NAME
ON TABLE HOLD AS H001 FORMAT ALPHA
END
-RUN
-READ H001 &MAXREC.I9.
-TYPE MAXREC &MAXREC
TABLE FILE BOTLOG2
LIST *
ON TABLE HOLD AS H002 FORMAT ALPHA
END
-RUN
TABLE FILE H002
PRINT *
WHERE E01 GT (&MAXREC - 10)
END
-RUN
This determines the number of rows in the FOCUS database. Then it lists all the rows, creating a counter column called list. Then it prints the last 10 rows.
- SET COUNTWIDTH changes the default size of the COUNT and LIST generated columns from I5 to I9. - E01 is used because the column name "LIST" (generated by the previous LIST command) cannot be used as the filter column.
BOTLO2 is probably a good candidate for a cleanup, using CREATE or REORG - I'm not sure if there is a Report Caster utility that cleans up this log file.
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
As for STAT_BY_NAME, they appear to be randomly named (eg: J14b1ka5vk29) and you can have dozens of rows for each STAT_BY_NAME, so BY HIGHEST 10 STAT_BY_NAME will probably not give you the last 10 rows in BOTLOG2. Those date stamps, START_STAMP and END_STAMP (e.g. 00000000000000000001246147201071) don't look like the GMT I know of, is some kind of conversion required? I recall reading a few posts on this subject.
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