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.
I have a delivery date that I then need to find the next specific weekday. For example, if a delivery date is 20110728 and my service date is on Tuesday, I need to find the date of that following Tuesday 20110802.
Is this possible? I know about the DATEMOV/NBD function but it's not necessarily the next business day but more a specific day of the week after that date that I need.
ThanksThis message has been edited. Last edited by: Kerry,
Version 7.6.9 Windows All (excel, PDF, powerpoint, html, active html)
This one is simple but I am not sure why it is picking up the BD which is 2 weeks from now... I had to substract one week from the result ..
SET BUSDAYS = __T____
TABLE FILE CAR
PRINT
COMPUTE NEW_DATE/YYMD = '&DATEYYMD';
-*COMPUTE NEW_DATE/WT = DATECVT(HIRE_DATE, 'I6YMD', 'YYMD'); AS 'DOW'
COMPUTE NBD/YYMD = DATEMOV(NEW_DATE, 'NBD');
COMPUTE PBD/YYMD = DATEMOV(NEW_DATE, 'PBD');
COMPUTE NEXTSERVICEDT/YYMD = DATEADD(NBD,'D',-7);
BY CAR NOPRINT
END
-EXIT
Another way is to find out the week day of the current day or your delivery date and find out the next service day based on the week day..i.e whether it is a Tuesday or Wed etc....
-SET &SERVICE_DAY = 'TUESDAY';
TABLE FILE CAR
PRINT
COMPUTE NEW_DATE/YYMD = '20110728';
COMPUTE NEW_DATE1/I6YMD = DATECVT(NEW_DATE,'YYMD','I6YMD');
COMPUTE DOWK1/A4 = DOWK(NEW_DATE1,'A4');
COMPUTE BUSDAY/I1 = IF '&SERVICE_DAY' EQ 'TUESDAY' THEN DECODE DOWK1(MON 1 TUE 7 WED 6 THU 5 FRI 4 SAT 3 SUN 2 )
ELSE DECODE DOWK1(MON 2 TUE 1 WED 7 THU 6 FRI 5 SAT 4 SUN 3 ) ;
COMPUTE NEXTSERVICEDT/YYMD = DATEADD(NEW_DATE,'D',BUSDAY);
BY CAR NOPRINT
END
-EXIT
You have to extend the IF THEN in the compute to cover all the week days...
thanks Sashanka
WF 7.7.03/Windows/HTML,PDF,EXL POC/local Dev Studio 7.7.03 & 7.6.11
I used your second example and it works great with the exception that it's calculating the DOWK for the wrong day. For example, your code produces a day of FRI for 11/07/28 which is actually a THU. Any clue how to fix that? If I can, then this solves my problem.
That's because you have different settings for defcent, I guess. If you change the 2nd compute to read: COMPUTE NEW_DATE1/I8YYMD = NEW_DATE; you'll both have the same output.
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007
Once you have a "smart" date, it's easy. No date-conversion functions are required.
-DEFAULT &DAY='TUE';
-* use CAR to generate 15 consecutive dates.
DEFINE FILE CAR
DATE1/WMDYY WITH MODEL=
IF DATE EQ 0
THEN '&DATEMDYY'
ELSE DATE + 1;
-*******************************************
W1/WT=DATE;
W2/WT='&DAY';
-* compute how many days to add (0 TO 6)
N/I5=IMOD(7+W2-W1,7,'I5');
DATE2/WMDYY=DATE1+N;
-*******************************************
END
TABLEF FILE CAR
LIST DATE1 W1 W2 N DATE2
IF RECORDLIMIT EQ 15
END
The code has no magic constants. (It does not depend on the convention for assigning weekday numbers, and would work whether the range were 0 to 6 or 1 to 7; and regardless of which days are assigned the start and end positions in the week)
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005