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] Move to previous weekday

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Move to previous weekday
 Login/Join
 
Platinum Member
posted
Hi All,

All I want to do is, within a loop, move from a day to the prior weekday, execute some code, move to the prior weekday, execute some code etc. Moving to the prior weekday seems to fail when around month boundaries. I cannot for the life of me determine why this is not working. Please note the following:

20101031 is a Sunday so moving to the PWD should give 20101029, a Friday, but it produces a result of 20101028, a Thursday. If I change &NEWDATE to 20101030, a Saturday, I get a result of 20101028.

If I change &NEWDATA to 20101101 then the code works properly. It seems that if the date I'm trying to convert/move falls on a weekend then the code fails. Do you think I'm gonna have to code something that looks at the day of the week and then move one day at a time and lok at the day again etc. I'm stumped.

  

SET BUSDAYS = _MTWTF_
-SET &NEWDATE = '20101031';
-SET &NEWDATE = DATECVT((DATEMOV(DATECVT(&NEWDATE,'I8YYMD','YYMD'), 'PWD')), 'YYMD', 'I8YYMD');
-TYPE &NEWDATE;



Any help would be appreciated.

Thanks,

Norb

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


prod:7.6.9, win2k3 mre, caster, bid, devstudio 7.6.9
 
Posts: 242 | Location: Minneapolis | Registered: February 16, 2006Report This Post
Expert
posted Hide Post
Hi Norb,

Try using the previous business day instead of prior weekday -

-SET &NEWDATE = DATECVT((DATEMOV(DATECVT(&NEWDATE,'I8YYMD','YYMD'), 'BD-')), 'YYMD', 'I8YYMD');

previous weekday (WD-) also works but would not cater for holidays.

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
Platinum Member
posted Hide Post
Hi Tony,

I tried your suggestion and it does indeed work when the date I am moving from is a weekend day but fails when the day is a weekday. I suspect I'm going to have to do some very specific checking on the day of the week and branch off accordingly. Confused

Thanks for your prompt reply.

Norb


prod:7.6.9, win2k3 mre, caster, bid, devstudio 7.6.9
 
Posts: 242 | Location: Minneapolis | Registered: February 16, 2006Report This Post
Virtuoso
posted Hide Post
Looks to me like there is a bug when using the 'PWD' parameter with DATEMOV. Here's a work-around that seems to work. Subtract one day from the start date and then use DATEMOV with the 'WD-' parameter. This will move to the previous workday if the current date is a weekend, but leave the date where it is if it's a weekday.

-SET &NEWDATE = '20101031';
-SET &NEWDATE = DATECVT((DATEMOV(DATECVT(&NEWDATE, 'I8YYMD', 'YYMD') - 1, 'WD-')), 'YYMD', 'I8YYMD');
-TYPE &NEWDATE


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report 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] Move to previous weekday

Copyright © 1996-2020 Information Builders