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'm trying to run a query to retrieve all records where date1 is certain days later than date2. Tried 2 method. In both ways, webfocus will pull the whole table down first, then compare them in the result set.
1. use define:
DEFINE FILE TBLXXX DIFF/I4=HDIFF(DATE1,DATE2,'dd',DIFF); END
TABLE FILE TBLXXX PRINT DATE1 DATE2 WHERE DIFF GT 10 END
2. use HDIFF in WHERE clause:
TABLE FILE TBLXXX PRINT DATE1 DATE2 WHERE HDIFF(DATE1,DATE2,'dd','I4') GT 10; END
When I turn TRACE on, both execute the same SQL to pull over 1 million records down first:
16.35.43 BR (FOC2598) FOCUS IF/WHERE TEST CANNOT BE PASSED TO SQL : WHERE exp 16.35.43 BR (FOC2590) AGGREGATION NOT DONE FOR THE FOLLOWING REASON: 16.35.43 BR (FOC2594) AGGREGATION IS NOT APPLICABLE TO THE VERB USED 16.35.43 AE SELECT T1."DATE1",T1."DATE2" FROM 16.35.43 AE SCHEMA.TBLXXX T1;
Is there a better way to let it compare in DB first?
My DB is Oracle, but if there is a way to do it, it should be DB independent right?
Thanks.This message has been edited. Last edited by: bug,
7.66 and 7.704 System: Windows / AIX / Linux Output: Mostly HTML, with some PDF, Excel and Lotus(!)
Posts: 147 | Location: Toronto (GTA) | Registered: May 25, 2005
Have you tried converting your dates to Smart Dates? I don't know if the SQL translator can translate HDATE or not. If not, maybe it cannot translate any of the DATETIME functions. In that case, the only solution may be to use pass-thru SQL and write the SQL yourself.
DEFINE FILE TBLXX
DATE1X/YYMD = HDATE(DATE1,'YYMD');
DATE2X/YYMD = HDATE(DATE2,'YYMD');
END
-*
TABLE FILE TBLXXX
PRINT DATE1 DATE2
WHERE ( DATE1X - DATE2X ) GT 10 ;
END
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
Dan, I have faced this situation before and no, the SQL translator to Oracle adapter cannot resolve HDATE or any other date function for that matter.
Danny's suggestion is the way to go!
As one may probably still need to "see" Oracle date fields as TIMESTAMPs (since that's what they are anyway), one approach I usually use when hitting cases like this is to manually add an extra field declaration to the masterfile referencing the same database column but using of course a different name; that virtual field would have USAGE=YYMD, ACTUAL=DATE as pointed by Danny.
To illustrate the idea, here's a sample masterfile as originally created on an Oracle table:
After manually modifying it I now have access to a "new" CREATE_DT_YYMD field which can be used on WHERE and BY statements handled directly by the database instead of by WebFOCUS.
A note of caution: manually altering the master can certainly provide viable solutions - as long as anyone using the synonym generator to refresh or re-create the master knows and remembers to add these manual entries to the master aferwards.
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
I'm glad it helped! Please do keep in mind Dan's note of caution though, since as he points out manual adjustments to the master file get broken after a "Synonym refresh" so if the latter happens make sure to manually edit the master and adjust it accordingly.