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] Figuring the date minus 364 days

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Figuring the date minus 364 days
 Login/Join
 
Member
posted
I am using the following to get yesterday's date:

-SET &RPTDATE = &YYMD;
-SET &PRIORDAY = &RPTDATE - 1;
-*-SET &PREVYRDAY = &PRIORDAY - 364;
-TYPE &RPTDATE &PRIORDAY
-EXIT

and get the following result

20101229 20101228

now I need to get 364 days prior to the &PRIORDAY result. When I try the following code

-SET &RPTDATE = &YYMD;
-SET &PRIORDAY = &RPTDATE - 1;
-SET &PREVYRDAY = &PRIORDAY - 364;
-TYPE &RPTDATE &PRIORDAY &PREVYRDAY
-EXIT

I get the following results

20101229 20101228 20100864

which are obviously NOT what I want. The challenge for me is that the DATEADD function and the DAYMD function do not work for us with our current adapter version. Anyone have any suggestions? I am spinning my wheels at the moment.

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


WebFOCUS Dev Studio 7.6.11
Windows, all output
 
Posts: 6 | Registered: December 10, 2010Report This Post
Expert
posted Hide Post
As you have discovered, adding and subtracting number from a date in dialog manager only takes the date as a number.

Have you tried AYMD ?

-SET &RPTDATE = &YYMD;
-SET &PRIORDAY = AYMD(&RPTDATE,-1,'I8YYMD') ;
-SET &PREVYRDAY = AYMD(&PRIORDAY,-365,'I8YYMD') ;
-TYPE &RPTDATE &PRIORDAY &PREVYRDAY
-EXIT


Check out the AYMD function in the documentation, under Legacy Date Functions.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Member
posted Hide Post
Solved - that did it. I just couldn't come up with that. Must have looked at it too long this morning.
Thanks, all


WebFOCUS Dev Studio 7.6.11
Windows, all output
 
Posts: 6 | Registered: December 10, 2010Report This Post
Gold member
posted Hide Post
How to take care of the case where year is a leap year?

Please Help


In Focus since 2008
WebFOCUS 8.2.0.1
Windows 7 - IE,Chrome,Firefox
Excel, PDF, HTML, AHTML, XML
JavaScript, jQuery, D3.js, Highcharts
 
Posts: 79 | Location: New York | Registered: February 04, 2010Report This Post
Platinum Member
posted Hide Post
How to find if a year is a leap year or not?

IS ther any WF function?

-Hari
WF-769


WF 7.7.02 on Windows 7
Teradata
HTML,PDF,EXCEL,AHTML
 
Posts: 165 | Registered: September 29, 2008Report This Post
Expert
posted Hide Post
Not specifically, but you can always grow your own if you just think about it a while -

DEFINE FUNCTION IS_LEAP(YEAR/I4)
  IS_LEAP/A1 = IF EDIT(YEAR,'$$99') EQ '00' AND (INT(YEAR / 400) * 400 NE YEAR) THEN 'N'
          ELSE IF (INT(YEAR / 4) * 4 EQ YEAR) THEN 'Y' ELSE 'N';
END
-RUN

-REPEAT :Loop FOR &Year FROM 1900 TO 2012;
-SET &LeapYear = IS_LEAP(&Year);
-TYPE &Year &LeapYear
-:Loop

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
Nice Function Tony.

Full DM Solution:
-SET &YearToCheck = 2012 ;
-SET &IsItALeapyear = IF (INT(&YearToCheck / 4) * 4 EQ &YearToCheck) THEN 'Leap Year' ELSE 'Regular Year' ; 
-TYPE *** &YearToCheck is a &IsItALeapyear ***
-SET &YearToCheck as desired.
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Platinum Member
posted Hide Post
Thanks a lot Tony and Doug. The code is simple and great.


WF 7.7.02 on Windows 7
Teradata
HTML,PDF,EXCEL,AHTML
 
Posts: 165 | Registered: September 29, 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] Figuring the date minus 364 days

Copyright © 1996-2020 Information Builders