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     [CLOSED] DATEADD One Month

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] DATEADD One Month
 Login/Join
 
Platinum Member
posted
If I understand correctly,
DATEDD(&YYMD,'M',1)
will add one month to the &YYMD value.

But what does WebFOCUS consider one month equal to? 30 days? Same day, but prior month?

Just curious.

This message has been edited. Last edited by: <Kathryn Henning>,


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Virtuoso
posted Hide Post
It use an internal matrix to reduce (or add) the number of days in a month to go to the previous or the next one without creating an invalid date.

Per example:
DEFINE FILE CAR
MTH1/YYMD=DATEADD('2014/03/31', 'M', -1);
MTH2/YYMD=DATEADD('2014/03/31', 'M', -2);
MTH3/YYMD=DATEADD('2014/03/31', 'M', -3);

MTH4/YYMD=DATEADD('2014/03/25', 'M', -5);

END
TABLE FILE CAR
BY COUNTRY NOPRINT
BY MTH1
BY MTH2
BY MTH3
BY MTH4
WHERE COUNTRY EQ 'FRANCE';
END
-RUN


Is resulting in:
MTH1       MTH2       MTH3       MTH4 
2014/02/28 2014/01/31 2013/12/31 2013/10/25 


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2410 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Expert
posted Hide Post
The date has to be a "smart date", not a text string, which is what &YYMD, and, any Dialogue Manger value is unless converted:

-SET &MTH_1 = DATECVT(DATEADD(DATECVT(&YYMD,'I8YYMD','YYMD'),'M',+1), 'YYMD', 'I8YYMD');
-TYPE &MTH_1
-EXIT


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Virtuoso
posted Hide Post
Was just to show the result of month shift with different input date values.
Was easier, I've been lazy Wink
But true, the input of DATEADD, must be a smartdate.
DEFINE FILE CAR
DTE/YYMD=&YYMD;
DT_1 /YYMD=DATEADD(DTE, 'M', -1);
END
TABLE FILE CAR
PRINT DTE DT_1
BY COUNTRY
WHERE COUNTRY EQ 'FRANCE';
END


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2410 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Platinum Member
posted Hide Post
ok, so it is not just subtracting 30, for example, which is what I was trying to confirm.

Thank you.


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Virtuoso
posted Hide Post
And it's smart enough to take care of the leap years as per below example. (I know I used a text date, but it's just to show Cool)
DEFINE FILE CAR
MTH1/YYMD=DATEADD('2012/03/31', 'M', -1);
END
TABLE FILE CAR
BY COUNTRY NOPRINT
BY MTH1
WHERE COUNTRY EQ 'FRANCE';
END
-RUN


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2410 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Expert
posted Hide Post
seems to be a theme today. Tom, look up the AYMD and AYM functions, for working with &var dates, adding and subtracting. You'll enjoy knowing about them.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report 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     [CLOSED] DATEADD One Month

Copyright © 1996-2020 Information Builders