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]Get Last Business Day

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]Get Last Business Day
 Login/Join
 
Master
posted
Hi,

I would like to get the last business day by using DATEADD but it seems like not working.

Here is my code

SET HDAY=TEST
SET BUSDAYS = _MTWTF_

-SET &PREVDAY=DATEADD(&YYMD,'BD'-1);

-TYPE PREVDAY &PREVDAY
-EXIT

The above code returns 0. I tried 'WD' but even this is not working correct when I try to get previous dates.

Am I missing anything here.

Thanks,

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


WFConsultant

WF 8105M on Win7/Tomcat
 
Posts: 780 | Location: Florida | Registered: January 09, 2005Report This Post
Virtuoso
posted Hide Post
From the functions manual:
quote:
Do not use DATEADD with Dialogue Manager. DATEADD requires a date to be in date format;
Dialogue Manager interprets a date as alphanumeric or numeric.

To use DATEADD in Dialogue Manager, you will need to use the DATECVT function to convert your DM date to a valid SmartDate value, then perform your DATEADD, and then convert the result back to a DM value.


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Master
posted Hide Post
Thanks Dan.

That works.


WFConsultant

WF 8105M on Win7/Tomcat
 
Posts: 780 | Location: Florida | Registered: January 09, 2005Report This Post
Master
posted Hide Post
I forget who initially suggested this, may have been Francis, but this works great. Create DEFINE FUNCTIONs for DATEADD, DATEDIF and DATEMOV for use with Dialogue Manager. Just include the following in the edasprof and it is always available:

-*
-*  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
-*
-*  Use this function to use DATEDIF in Dialogue Manager
-*
 DEFINE FUNCTION UDATEDIF(FROM_DATE/A8YYMD, TO_DATE/A8YYMD, DIF_UNIT/A2)
   FRDT/YYMD       = FROM_DATE;
   TODT/YYMD       = TO_DATE;
   UDATEDIF1/YYMD  = DATEDIF(FRDT, INDT, DIF_UNIT);
   UDATEDIF/A8YYMD = UDATEDIF1;
 END
-RUN
-*
-*  Use this function to use DATEMOV in Dialogue Manager
-*
 DEFINE FUNCTION UDATEMOV(INDATE/A8YYMD, INMVTO/A3)
   INDATE1/YYMD    = INDATE;
   UDATEMOV1/YYMD  = DATEMOV(INDATE1, INMVTO);
   UDATEMOV/A8YYMD = UDATEMOV1;
 END
-RUN


Now you can do this:

SET HDAY=TEST
SET BUSDAYS = _MTWTF_
-RUN
-SET &PREVDAY=UDATEADD(&YYMD,'BD',-1);
-SET &LASTDAY=UDATEMOV(&YYMD,'EOM');
-SET &BDAYSDIF=UDATEDIF(&PREVDAY,&LASTDAY,'BD');
-TYPE &YYMD &PREVDAY &LASTDAY &BDAYSDIF

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
  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]Get Last Business Day

Copyright © 1996-2020 Information Builders