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] Dates in WebFocus

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Dates in WebFocus
 Login/Join
 
<sdavis>
posted
I need to subtract 5 years from current date in Webfocus to use as a variable

This message has been edited. Last edited by: Kerry,
 
Report This Post
Expert
posted Hide Post
sdavis,
first you need to know if the date you're working on is via Dialog Manager, or actually a datefield in your data file.
You want to make sure your date is a SMART date; that's a specific FOCUS date type. (Its the serial value, the same way dates are handled in excel for instance), and the methods for doing that are different between the two places.
Take a look at your manual, WebFocus Using Functions, chapter 7 . its absolutely all there, i promise! Do you have access to the manual? Its downloadable in pdf.
ITODAY/I8YYMD = &YYMD ;
TODAY/YYMD = ITODAY;
THISYEAR/YY = TODAY;
YESTERDAY/YYMD = DATEADD(TODAY,'D',-1);
LASTYEAR1/YYMD = DATEADD(TODAY,'Y',-1);
LASTYEAR/YY = LASTYEAR1 ;
NEXT5YEAR1/YYMD = DATEADD(TODAY,'Y',5);
NEXT5YEAR/YY = NEXT5YEAR1;
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Platinum Member
posted Hide Post
Substract 60 months (5 years * 12) from actual Year/Month using AYM() function and concat the actual day.


-SET &YM = EDIT(&YYMD, '999999') ;
-SET &YM60 = AYM(&YM, -60, 'I6') ;
-SET &DATE5 = &YM60 | EDIT(&DMYY, '99') ;
-TYPE Actual date: &YYMD
-TYPE 5 years before: &DATE5

Regards,
Mikel

This message has been edited. Last edited by: <Mabel>,
 
Posts: 173 | Location: Madrid, Spain | Registered: May 09, 2003Report This Post
<sdavis>
posted
quote:
Originally posted by Mikel:
[qb] Substract 60 months (5 years * 12) from actual Year/Month using AYM() function and concat the actual day.
-SET &YM = EDIT(&YYMD, '999999') ;
-SET &YM60 = AYM(&YM, -60, 'I6') ;
-SET &DATE5 = &YM60 | EDIT(&DMYY, '99') ;
-TYPE Actual date: &YYMD
-TYPE 5 years before: &DATE5
Regards,
Mikel [/qb]

This message has been edited. Last edited by: <Mabel>,
 
Report This Post
<sdavis>
posted
quote:
Originally posted by sdavis:
[qb]
quote:
Originally posted by Mikel:
[qb] Substract 60 months (5 years * 12) from actual Year/Month using AYM() function and concat the actual day.


-SET &YM = EDIT(&YYMD, '999999') ;
-SET &YM60 = AYM(&YM, -60, 'I6') ;
-SET &DATE5 = &YM60 | EDIT(&DMYY, '99') ;
-TYPE Actual date: &YYMD
-TYPE 5 years before: &DATE5

Regards,
Mikel [/qb]
[/qb]
Thank you very much Mike for the information;
I will try it and see if it works for me. Appreciate the help.

This message has been edited. Last edited by: <Mabel>,
 
Report This Post
Guru
posted Hide Post
quote:
TODAY/YYMD = ITODAY;

This is the formate of table
dim_Time_key FiscalYear Period Week
1 2004 01 1

Date CalendarYear FYPW FYP
2003-03-29 2003 2004011 200401

Date is dateformat, Period and week can be calculated from FYPW.
I am trying to get TODAY - 7 as current period because my data gets updated every 7 days, so previous week is my current period and week.

I tried follwing but it didnt work
Current = TODAY - 7
CURPERIOD = FYPW
WHERE Current = DATE

Orignal question was:
How do I get Current Period, Previous 1, Previous 2, Previous 3


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Expert
posted Hide Post
Please move this post to your original post on this topic so we can address it all in one place.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Virtuoso
posted Hide Post
quote:
Substract 60 months (5 years * 12) from actual Year/Month using AYM() function and concat the actual day.

Try that with a leap year Feb 29 and you come up with an invalid date. I would stick with the DATEADD function.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Member
posted Hide Post
I remember seeing a variation of this on the forums some time back... Try this:

-SET &5_YRS_AGO = (DATECVT((DATEADD((DATECVT(&YYMD,'I8YYMD','YYMD')),Y,5)),'YYMD','I8YYMD'));


Erfan
WF 7.6.5 Dev Studio / BID / Info Assist / Report Caster


WF 7.6.5 / BID / Info Assist / Report Caster - HTML/PDF/EXCEL
 
Posts: 18 | Registered: September 27, 2007Report This Post
Expert
posted Hide Post
-SET &5_YRS_AGO = (DATECVT((DATEADD((DATECVT(&YYMD,'I8YYMD','YYMD')),Y,-5)),'YYMD','I8YYMD'));
-TYPE &5_YRS_AGO


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 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     [CLOSED] Dates in WebFocus

Copyright © 1996-2020 Information Builders