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.
I am having a problem using the HIGHEST function using the table below to return the single highest date, that is less than today's date. The function is being used in the first of 3 hold files. The results returns the lowest date record, 2005/08/20.
RATE TABLE ===========
ACCOUNT_NBR EFFECTIVE_DATE REG_RATE SWCGOVT08 2007/09/29 135.21 SWCGOVT08 2006/09/30 130.01 <- record I want to display SWCGOVT08 2005/10/01 125.01 SWCGOVT08 2005/09/03 120.20 SWCGOVT08 2005/08/20 120.20
The codes is: ============== DEFINE FILE HLD_FILE1 df_Today/YYMD = &YYMD;
END -* ********************************* -* TABLE FILE HLD_FILE1 PRINT HLD_FILE1.SUPPLIER_ID HLD_FILE1.df_ACTIVE HLD_FILE1.ACCOUNT_NUMBER RATES.RATES.EFFECTIVE_DATE/MDY RATES.RATES.REG_RATE/P12.2M AS 'REG RATE' RATES.RATES.OT_RATE/P12.2M AS 'OT RATE'
BY HLD_FILE1.PO_NUMBER NOPRINT BY HLD_FILE1.ACCOUNT_NUMBER NOPRINT BY HIGHEST 1 RATES.RATES.EFFECTIVE_DATE NOPRINT -* WHERE RATES.RATES.EFFECTIVE_DATE LT df_Today; -* ON TABLE HOLD AS HLD_FILE2This message has been edited. Last edited by: Guillo,
Leah: I'm not sure how to use the MAX function in this instance.
Albert: The value of the PO number is the same for all the 10 records that should be returned, each with different effective dates.
Frank: I tried placing the HIGHEST statement as the first and it returned on 1 of 10 records but the date was still not correct. I tried removeing the 2 other BY statements, results the same. I remove the 1 from the HIGHEST statment, results the same. The effective date that keeps coming back is the oldest record not the newest or the one that is LT today which is what I need.
Originally posted by Guillo: Thank you all for the quick responses.
Leah: I'm not sure how to use the MAX function in this instance.
Albert: The value of the PO number is the same for all the 10 records that should be returned, each with different effective dates.
Frank: I tried placing the HIGHEST statement as the first and it returned on 1 of 10 records but the date was still not correct. I tried removeing the 2 other BY statements, results the same. I remove the 1 from the HIGHEST statment, results the same. The effective date that keeps coming back is the oldest record not the newest or the one that is LT today which is what I need.
The HOLD file contains 10 records for different accounts_nbrs. Each account_nbr may have multiple rates in the rate table of which I need the latest/current rate where the effective_date is less than today.
ACCT_NBR EFF_DATE RATE SWCGOVT08 2007/09/29 135.21 SWCGOVT08 2006/09/30 130.01 <- record I want to display SWCGOVT08 2005/10/01 125.01 SWCGOVT08 2005/09/03 120.20 SWCGOVT08 2005/08/20 120.20 SWCGOVT04 2007/09/29 135.21 SWCGOVT04 2005/10/01 125.01 <- record I want to display SWCGOVT04 2005/09/03 120.20 SWCGOVT04 2005/08/20 120.20
Used this focexec:
TABLE FILE HIGHRATE PRINT * BY ACCOUNT_NBR NOPRINT BY HIGHEST 1 EFFECTIVE_DATE NOPRINT WHERE EFFECTIVE_DATE LT '2007/08/28' END
Produced the following:
ACCOUNT_NBR EFFECTIVE_DATE REG_RATE FILLER ----------- -------------- -------- ------ SWCGOVT04 2005/10/01 125.01 <- record I want to display SWCGOVT08 2006/09/30 130.01 <- record I want to display
Not sure where you're going wrong, sorry.
Posts: 13 | Location: Montreal,Canada | Registered: August 22, 2007
Ah, I've never used the highest x (where x is the number), has that been valid for all versions of WebFOCUS. Some times you just stick to the old comfortable ways.
I agree the sort needs to include the account number as the 'by' just before the 'by' for the date.
I ususally just do a code compute and where total to get the record.
In English not code correct here.
compute wanted/a1 if account number eq last acount number then 'n' else 'y';
where total wanted eq 'y'
As they say there is more than one way to skin a cat.
Leah
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004
I took a look at the JOIN statement in the code for the HOLD file and found that the orignial statement did not have the MULITPLE verb in it. The orginal statement read:
JOIN HLD_FILE1.ACCOUNT_NUMBER IN HLD_FILE1 TO RATES.RATES.ACCOUNT_NUMBER IN RATES AS J006 END
The new codes reads:
JOIN HLD_FILE1.ACCOUNT_NUMBER IN HLD_FILE1 TO MULTIPLE RATES.RATES.ACCOUNT_NUMBER IN RATES AS J006 END
The MULTIPLE verb seems to make all the rates record to be read and have the where condition applied. This produced the results I was after.