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] max and or "last"

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] max and or "last"
 Login/Join
 
Member
posted
I need to find the most recent transaction; a single invoice can have many post dates, some are the same date; the duplicate post dates have unique line item entry numbers. I know I can identify the row with the most recent post date, HOLD it, and then find the highest line item number, but is there is a way to do this in a single step? My goal is to extract the value in a different column, based on most recent post date and highest line item number.

Thank you

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


WebFocus 762,7611, 7.7.02 XP for Dev/test; Linux Prod 7.6.2; MRE
 
Posts: 21 | Location: NYC | Registered: February 09, 2009Report This Post
Expert
posted Hide Post
What is the datasource ?

If you use TABLEF and PRINT, you will get the record in order of storage, it then depends on whether the storage order is correct.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
I suppose you could use:
BY HIGHEST 1 POSTDATE
BY HIGHEST 1 LINENO

A test is in order...


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
As WAZ says, to give a good answer, one has to know the data source.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Member
posted Hide Post
Pretty close. I am using:
PRINT
'MAX.DM_FACT_INVOICE.DM_FACT_INVOICE.POST_DATE' NOPRINT
BY 'DM_FACT_INVOICE.DM_FACT_INVOICE.INVOICE_NUM'
BY HIGHEST 1 'DM_FACT_INVOICE.DM_FACT_INVOICE.POST_DATE'
BY POST_DATE

But I am still getting a blank row where there was a 'duplicate' post_date. I need to eliminate the blank rows, I've tried a couple of of different sorts and "highest already. When this is working, I'll add the line item number.

Any suggestions?


WebFocus 762,7611, 7.7.02 XP for Dev/test; Linux Prod 7.6.2; MRE
 
Posts: 21 | Location: NYC | Registered: February 09, 2009Report This Post
Platinum Member
posted Hide Post
Make a define field that concatinates the two abnd take the MAX. Should work in most datasources (though you should check the generated SQL).


Brian Suter
VP WebFOCUS Product Development
 
Posts: 200 | Location: NYC | Registered: January 02, 2007Report This Post
Expert
posted Hide Post
PRINT
'MAX.DM_FACT_INVOICE.DM_FACT_INVOICE.POST_DATE' NOPRINT
BY 'DM_FACT_INVOICE.DM_FACT_INVOICE.INVOICE_NUM'
BY HIGHEST 1 'DM_FACT_INVOICE.DM_FACT_INVOICE.POST_DATE'
BY POST_DATE

A couple of comments:

- The "MAX" won't do anything here.
- The HIGHEST 1 won't do anything here, unless DM_FACT_INVOICE.DM_FACT_INVOICE.POST_DATE is a different column than POST_DATE.
- The "blank rows", are they really blank, or are they simply blank sort field values?

If you need the latest date for each invoice number, have you tried:

SUM
INVOICE_NUM NOPRINT
BY INVOICE_NUM
BY HIGHEST 1 POST_DATE


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
quote:
I need to find the most recent transaction; a single invoice can have many post dates, some are the same date; the duplicate post dates have unique line item entry numbers. I know I can identify the row with the most recent post date, HOLD it, and then find the highest line item number, but is there is a way to do this in a single step? My goal is to extract the value in a different column, based on most recent post date and highest line item number.


I'm not seeing any reference to line number in your code. The earlier post by Danny-SRL about using BY HIGHEST 1 should have done the trick.


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Member
posted Hide Post
This is the final working result:
PRINT
INVOICE_NUM NOPRINT
CUR_FSC_CD
INVOICE_BAL
BY INVOICE_NUM
BY HIGHEST 1 POST_DATE NOPRINT
BY HIGHEST 1 LINE_ITEM

I will also try the idea with the DEFINE to concatenate two columns and see if its faster.

thank you


WebFocus 762,7611, 7.7.02 XP for Dev/test; Linux Prod 7.6.2; MRE
 
Posts: 21 | Location: NYC | Registered: February 09, 2009Report 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] max and or "last"

Copyright © 1996-2020 Information Builders