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] today minus 1 day function in where clause.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] today minus 1 day function in where clause.
 Login/Join
 
Gold member
posted
I'm trying to subtract 1 day from the current day and use it in a where clause. I'm confused on the format. The ENTDATE and DATE define fields work but I can't get the DAYAGO define to work. I also tried using the AYMD function. Can someone please assist.

DEFINE FILE INFO 
ENTDATE/HMDYY=ENTRYDATE
DATE/A10=TODAY(DATE);
DAYAGO/MDYY=DATEADD(DATE, 'D', -1);
END
TABLE FILE INFO
NAME
ADDRESS     
ENTDATE
WHERE ENTDATE EQ DAYAGO;

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


WebFOCUS 7.6.2, MS Windows Server/______, Excel, PDF, HTML
 
Posts: 91 | Registered: May 15, 2008Report This Post
Expert
posted Hide Post
For starters, 1) add a semicolon at the end of this line: "ENTDATE/HMDYY=ENTRYDATE", 2) Add "DAYAGO" to your print line, 3) remove the WHERE statement, 4) Add a RECORDLIMIT and END, and see if "DAYAGO" is what you expect it to be, 5 take from there. and Smiler
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Gold member
posted Hide Post
Oops. I did have the semicolon at the end just didn't copy it over. I also tried to print the DAYAGO field but get the following error:
INVALID TYPE OF ARGUMENT #1 FOR USER FUNCTION DATEADD.

Should I have used the AYMD function?


WebFOCUS 7.6.2, MS Windows Server/______, Excel, PDF, HTML
 
Posts: 91 | Registered: May 15, 2008Report This Post
Expert
posted Hide Post
Change DATE/A10=TODAY(DATE);
to
DATE/YYMD = '&DATEYYMD.EVAL';

The function requires a smart date...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Gold member
posted Hide Post
quote:
DATE/YYMD = '&DATEYYMD.EVAL';


That worked Tom, but the where clause doesn't. I get the following error: (FOC280) COMPARISON BETWEEN COMPUTATIONAL AND ALPHA VALUES IS NOT ALLOWED
(FOC009) INCOMPLETE REQUEST STATEMENT

Do I need to convert the ENTDATE to Alpha?


WebFOCUS 7.6.2, MS Windows Server/______, Excel, PDF, HTML
 
Posts: 91 | Registered: May 15, 2008Report This Post
Expert
posted Hide Post
Change:ENTDATE/HMDYY=ENTRYDATE;
To: ENTDATE/MDYY=ENTRYDATE;

For the WHERE test, need to have the same format; apples-to-apples, oranges-to-oranges, etc...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Gold member
posted Hide Post
I can't change the ENTDATE to MDYY, because it has a date-time format when I remove the H it doesn't work.


WebFOCUS 7.6.2, MS Windows Server/______, Excel, PDF, HTML
 
Posts: 91 | Registered: May 15, 2008Report This Post
Silver Member
posted Hide Post
quote:
Originally posted by kitten:
I can't change the ENTDATE to MDYY, because it has a date-time format when I remove the H it doesn't work.


Use the HDATE function to get the datetime field into a simple date.

ENTDATE/MDYY=HDATE((ENTRYDATE,'MDYY');


WF: WebFocus 7.7.03
Data: Oracle, MSSQL, DB2
OS: Windows
Output: HTML/AHTML,PDF,EXL2K FORMULA, COMT
 
Posts: 43 | Registered: November 21, 2011Report This Post
Virtuoso
posted Hide Post
Using a DEFINE for a screening condition is not efficient.

As an example, and I am using an HYYMDs field here, if you are using a different format change the expressions:
-SET &YESTERDAY    = AYMD(&YYMD,-1,'I8');
-SET &YESTERDAY    = EDIT(&YESTERDAY,'9999/99/99');
 TABLE FILE GENERATED
 PRINT *
 WHERE GENERATED_TIMESTAMP FROM DT(&YESTERDAY 00:00:00) TO DT(&YESTERDAY 23:59:59);
 END


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Gold member
posted Hide Post
Thanks Tom and ND it works. However I experimented with Alan's solution for efficiency and it also worked. Thanks Alan for the efficiency tip!!!


WebFOCUS 7.6.2, MS Windows Server/______, Excel, PDF, HTML
 
Posts: 91 | Registered: May 15, 2008Report 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] today minus 1 day function in where clause.

Copyright © 1996-2020 Information Builders