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]DATEADD Function

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]DATEADD Function
 Login/Join
 
Guru
posted
I am using the following command

-SET &LAST_SATURDAY = DATEADD(&YYMD, 'D', -3)

the ECHO displays this
-SET &LAST_SATURDAY = DATEADD(20120703, 'D', - 3);

LAST_SATURDAY ends up being 20120700

Shouldn't it end up being 20120630? Do I need to use a different Date Format?

This message has been edited. Last edited by: Jay Potter,


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Report This Post
Guru
posted Hide Post
DATEADD uses smart dates. As a workaround you can use DATECVT to convert the date to a smart date. Then use DATEADD to subtract the days. Then uses DATECVT again to change the smart date into a numeric date.

  
-SET &LAST_SATURDAY = DATECVT(DATEADD(DATECVT(&YYMD,'I8YYMD','YYMD'),'D',-3),'YYMD','I8YYMD');
-TYPE &LAST_SATURDAY


WebFOCUS 8.1.05M Unix Self-Service/MRE/Report Caster - Outputs Excel, PDF, HTML, Flat Files
 
Posts: 320 | Location: Memphis, TN | Registered: February 12, 2008Report This Post
Virtuoso
posted Hide Post
DATEADD has issues with Dialog Manager. Can you do this in a define instead.


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Virtuoso
posted Hide Post
OR you can do that. Wink
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Guru
posted Hide Post
Thanks! The DATECVT worked. It's great when they document where you can use some in some places but not others.


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Report This Post
Virtuoso
posted Hide Post
You should get the book 1001 Ways to Work with Dates in WebFocus. It's documented there that it does not work with Dialog Manager. It's a great thing to have.
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Guru
posted Hide Post
Thanks! I will look into it.


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Report This Post
Expert
posted Hide Post
Prarie, I hope that book documents that you can use Date-Time functions in Dialog Manager when used in conjunction with DATECVT, e.g.
-SET &TEST1 = DATECVT(DATEADD(DATECVT(&YYMD,'I8YYMD','YYMD'),'D',-3),'YYMD','I8YYMD')


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
Expert
posted Hide Post
The other option is to use the legacy date function aymd.

Its all documented in the functions manual, it will pay to have a good look.

-SET &LAST_SATURDAY = AYMD(&YYMD,-3,'I8YYMD') ;

-TYPE &LAST_SATURDAY


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
Platinum Member
posted Hide Post
I just had this issue today and in 5 minutes I found the correct code to resolve it. The information here just saved my bacon (again) and made it look like I know what I'm doing. Smiler

Thanks to all who post here on Focal Point.

Norb


prod:7.6.9, win2k3 mre, caster, bid, devstudio 7.6.9
 
Posts: 242 | Location: Minneapolis | Registered: February 16, 2006Report This Post
Master
posted Hide Post
It would be a whole lot easier to create DEFINE FUNCTIONs for DATEADD, DATEMOV and DATEDIF. If done properly, anything you can do in a TABLE request with these function can be done in Dialogue Manager using the same syntax.


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
Expert
posted Hide Post
Absolutely.

DEFINE FUNCTION UDATEADD(INDATE/A8YYMD, INUNIT/A2, INNBR/I4)
INDATE1/YYMD    = INDATE;
UDATEADD1/YYMD  = DATEADD(INDATE1, INUNIT, INNBR);
UDATEADD/A8YYMD = UDATEADD1;
END
-RUN

-SET &DATE1 = UDATEADD(&YYMD, 'M', -3);

-TYPE &YYMD - &DATE1



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     [SOLVED]DATEADD Function

Copyright © 1996-2020 Information Builders