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 -- Yesterday's Date and same date last year

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Solved -- Yesterday's Date and same date last year
 Login/Join
 
Platinum Member
posted
I can get yesterday's date:
-SET &TODAY = &YYMD;
-SET &YDAY = AYMD (&TODAY, -1, 'I8YYMD');

How do I get the same date last year when there was no 20110229, I was subtracting 1 from the current year and using the month and day.

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


WF 8 version 8.2.04. Windows.
In focus since 1990.
 
Posts: 189 | Location: pgh pa | Registered: October 06, 2004Report This Post
Virtuoso
posted Hide Post
What would be the correct date for that rule? As you say, yesterday's date a year ago, or 20100229, does not exist.

Would that be 20100301 (365 days ago) or 20100228 (the nearest day in the same month)?


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Platinum Member
posted Hide Post
This subtracts one year from the date, and for the 29/02/2012 results in 28/02/2011.

LASTYEAR/YYMD=DATEADD(DATE_YYMD, 'Y', -1);


WF 7.6.11
Output: HTML, PDF, Excel
 
Posts: 123 | Location: UK | Registered: October 09, 2003Report This Post
Platinum Member
posted Hide Post
Tewy, Can this be done in Dialogue Manager?
LASTYEAR/YYMD=DATEADD(DATE_YYMD, 'Y', -1);


WF 8 version 8.2.04. Windows.
In focus since 1990.
 
Posts: 189 | Location: pgh pa | Registered: October 06, 2004Report This Post
Platinum Member
posted Hide Post
Yes, you need to do the following:

-SET &lastYear= DATECVT(DATEADD(DATECVT(&YYMD,'I8YYMD','YYMD'),'Y','-1'),'YYMD','I8YYMD');


WF 7.6.11
Output: HTML, PDF, Excel
 
Posts: 123 | Location: UK | Registered: October 09, 2003Report This Post
Platinum Member
posted Hide Post
Tewy - That did it. Thank you.

-SET &TODAY = &YYMD;
-SET &YDAY = AYMD (&TODAY, -1, 'I8YYMD');
-SET &lyday = DATECVT(DATEADD(DATECVT(&YDAY,'I8YYMD','YYMD'),'Y','-1'),'YYMD','I8YYMD');

-TYPE &|YDAY == &YDAY
-TYPE &|lyday == &lyday
-EXIT


WF 8 version 8.2.04. Windows.
In focus since 1990.
 
Posts: 189 | Location: pgh pa | Registered: October 06, 2004Report This Post
Master
posted Hide Post
Want to use DATEADD in DM, this works and in less confusing that DATECVT/DATEADD/DATECVT method.

Create the following DEFINE FUNCTION and -INCLUDE it in the edasprof

-*
-*  Use this function to use DATEADD in Dialogue Manager
-*
 DEFINE FUNCTION UDATEADD(INDATE/A8YYMD, INUNIT/A2, INNBR/I4)
   INDATE1/YYMD    = INDATE;
   UDATEADD1/YYMD  = DATEADD(INDATE1, INUNIT, INNBR);
   UDATEADD/A8YYMD = UDATEADD1;
 END
-RUN


Then in DM do this:

-SET &LASTYEAR=UDATEADD(&YYMD,'Y',-1);


I have DEFINE FUCTIONS for DATEADD, DATEMOV and DATEDIF.

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


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
Virtuoso
posted Hide Post
Good point, jgelona. Sticking DATECVT back and forth before any DATE computation in Dialogue Manager is usually a point of confusion to many, and a hard one to spot errors in when used in long expressions.

I like the idea of your user-defined functions and most importantly the fact that you kept the same "signature" as that of the original WebFOCUS ones ... definitely much easier to use.

Good One



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report 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 -- Yesterday's Date and same date last year

Copyright © 1996-2020 Information Builders