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] How to get business days?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] How to get business days?
 Login/Join
 
Guru
posted
Hi,

I need to print current business days on some reports but it´s showing wrong values.

-* File: IBFS:/localhost/EDA/EDASERVE/APPPATH/vesir21815/Procedure1.fex Created by WebFOCUS AppStudio
-DEFAULT &WEEK_DAY= 'XX';

SET BUSDAYS = _MTWTF_


-RUN

-***************************************************
-* REMOVE THIS BEFORE GOING TO PRODUCTION
-* THIS IS A TEST TO COMPARE VALUES FROM USER´S REPORT
-***************************************************
-SET &MONTH_YYMD = '20150502';

-SET &WEEEK_DAY = DOWK('&MONTH_YYMD.EVAL', 'A4');


-****************************************
-* GET FIRST DAY OF THE CURRENT MONTH
-****************************************

-SET &START_MONTH = DATECVT( DATEMOV(DATECVT(&MONTH_YYMD,'I8YYMD','YYMD'),'BOM'),'YYMD','I8YYMD');


-****************************************
-* GET LAST DAY OF THE CURRENT MONTH
-****************************************

-SET &END_MONTH = DATECVT( DATEMOV(DATECVT(&MONTH_YYMD,'I8YYMD','YYMD'),'EOM'),'YYMD','I8YYMD');


-****************************************
-* GET WORKING DAYS FROM 1ST DAY TO TODAY
-****************************************

-SET &CURRENT_WORKING_DAYS = DATEDIF(&START_MONTH, &MONTH_YYMD , 'BD');


-****************************************
-* GET WORKING DAYS FROM CURRENT MONTH
-****************************************
-SET &WORKING_DAYS = DATEDIF(&START_MONTH, &END_MONTH, 'BD');

-TYPE START: &START_MONTH END: &END_MONTH CURRENT_WD: &CURRENT_WORKING_DAYS TOTAL_WD: &WORKING_DAYS WEEKDAY: &WEEEK_DAY
-EXIT


reply: START: 20150501 END: 20150531 CURRENT_WD: 1 TOTAL_WD: 22 WEEKDAY: SAT

It was supposed to show:
CURRENT_WD = 0 (cause 20150501 was a holliday and 20150502 is Saturday).
TOTAL_WD = 20

Can anyone help me how to manipulate BUSDAYS?

Thanks

This message has been edited. Last edited by: Ricardo Augusto,


WebFOCUS 8.1.05 / APP Studio
 
Posts: 272 | Location: Brazil | Registered: October 31, 2006Report This Post
Guru
posted Hide Post
 
Posts: 272 | Location: Brazil | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
You are missing the MAIN piece, the Holiday file; click on DATEDIF and read about Business Days...

I also would not use Dialogue Manager(nothing but text strings); put into a DEFINE or COMPUTE.

This link should help...

This message has been edited. Last edited by: Tom Flynn,


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Guru
posted Hide Post
Ok. It needs a HDAY file.


WebFOCUS 8.1.05 / APP Studio
 
Posts: 272 | Location: Brazil | Registered: October 31, 2006Report This Post
Guru
posted Hide Post
Now it seems to be ok.

DEFINE FILE CAR
TODAY/YYMD= '&MONTH_YYMD.EVAL';
START_CURRENT_MONTH/YYMD = DATECVT( DATEMOV(DATECVT(&MONTH_YYMD,'I8YYMD','YYMD'),'BOM'),'YYMD','I8YYMD');
END_CURRENT_MONTH/YYMD = DATECVT( DATEMOV(DATECVT(&MONTH_YYMD,'I8YYMD','YYMD'),'EOM'),'YYMD','I8YYMD');
CURRENT_WORKING_DAYS/I4 = DATEDIF(START_CURRENT_MONTH, TODAY, 'BD');
TOTAL_WORKING_DAYS/I4 = DATEDIF(START_CURRENT_MONTH, END_CURRENT_MONTH, 'BD');

END

TABLE FILE CAR
PRINT TODAY START_CURRENT_MONTH END_CURRENT_MONTH CURRENT_WORKING_DAYS TOTAL_WORKING_DAYS
BY COUNTRY NOPRINT
WHERE RECORDLIMIT EQ 1
END



-EXIT

This message has been edited. Last edited by: Ricardo Augusto,


WebFOCUS 8.1.05 / APP Studio
 
Posts: 272 | Location: Brazil | Registered: October 31, 2006Report This Post
Guru
posted Hide Post
This logic is not good.

-* File: IBFS:/localhost/EDA/EDASERVE/APPPATH/vesir21815/Procedure1.fex Created by WebFOCUS AppStudio


SET BUSDAYS = _MTWTF_
SET HDAY=BRZ


-***************************************************
-* REMOVE THIS BEFORE GOING TO PRODUCTION
-* THIS IS A TEST TO COMPARE VALUES FROM USER´S REPORT
-***************************************************
-SET &MONTH_YYMD = '20150101';


DEFINE FILE CAR

-***************
-* CURRENT MONTH
-***************
TODAY/YYMD= '&MONTH_YYMD.EVAL';
START_CURRENT_MONTH/YYMD = DATECVT( DATEMOV(DATECVT(&MONTH_YYMD,'I8YYMD','YYMD'),'BOM'),'YYMD','I8YYMD');
END_CURRENT_MONTH/YYMD = DATECVT( DATEMOV(DATECVT(&MONTH_YYMD,'I8YYMD','YYMD'),'EOM'),'YYMD','I8YYMD');

CURRENT_WORKING_DAYS/I4 = DATEDIF(START_CURRENT_MONTH, TODAY, 'BD');
TOTAL_WORKING_DAYS/I4 = DATEDIF(START_CURRENT_MONTH, END_CURRENT_MONTH, 'BD');


-***************
-* LAST MONTH
-***************
TODAY_YYM/I6YYM =TODAY;

LAST_MONTH/I6YYM =AYM(TODAY_YYM, -1, 'I6YYM');

START_LAST_MONTH/YYMD = DATECVT( DATEMOV(DATECVT(LAST_MONTH,'I6YYM','YYMD'),'BOM'),'YYMD','I8YYMD');
END_LAST_MONTH/YYMD = DATECVT( DATEMOV(DATECVT(LAST_MONTH,'I6YYM','YYMD'),'EOM'),'YYMD','I8YYMD');
LAST_WORKING_DAYS/I4 = DATEDIF(START_LAST_MONTH, END_LAST_MONTH, 'BD');

END

TABLE FILE CAR
PRINT TODAY START_CURRENT_MONTH END_CURRENT_MONTH CURRENT_WORKING_DAYS TOTAL_WORKING_DAYS LAST_MONTH START_LAST_MONTH END_LAST_MONTH LAST_WORKING_DAYS
BY COUNTRY NOPRINT
WHERE RECORDLIMIT EQ 1
END


Results:
PAGE 1

TODAY START_CURRENT_MONTH END_CURRENT_MONTH CURRENT_WORKING_DAYS TOTAL_WORKING_DAYS LAST_MONTH START_LAST_MONTH END_LAST_MONTH LAST_WORKING_DAYS
2015/01/01 2015/01/01 2015/01/31 0 22 2014/12 2014/12/01 2014/12/31 0

Can anyone share a working logic to handle working days?

thanks


WebFOCUS 8.1.05 / APP Studio
 
Posts: 272 | Location: Brazil | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
Don't see the FILEDEF anywhere.
Did you click on this link and follow the instructions?


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Guru
posted Hide Post
I created it under C:\ibi\AppStudio81\srv81\home\nls\HDAYBRZ.err

I got it adding this lines on HDAYBRZ.err:

20141231
20150501
20151225
20151231
29991231


WebFOCUS 8.1.05 / APP Studio
 
Posts: 272 | Location: Brazil | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
Well, then does your code include the FILEDEF(which my question referred to?

FILEDEF HDAYBRZ DISK C:\ibi\AppStudio81\srv81\home\nls\HDAYBRZ.err
SET BUSDAYS = _MTWTF_
SET HDAY=BRZ

Also see you are on 8.1, version unknown???


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Guru
posted Hide Post
No, I didn´t add a FILEDEF and my fex is able to read HDAYBRZ.err content.


Edition: WebFOCUS
Product Release: 8.1
Service Pack: 0.5
Build Version: branch8105
Build/GEN Number: 119
Build/GEN Date: September 16, 2015 3:04:25 PM BRT
Application Server: Apache Tomcat/8.0.21


WebFOCUS 8.1.05 / APP Studio
 
Posts: 272 | Location: Brazil | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
8.1.05 is your version.
Can't tell if you got it, but, if you did, CONGRATULATIONS!
OH, now I see SOLVED, so, CONGRATS!
It is better that you figure it out, imo...
Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Guru
posted Hide Post
I guess when I send it into production I will need a FILEDEF to use HDAYBRZ.err under apps/application directory. Right?


WebFOCUS 8.1.05 / APP Studio
 
Posts: 272 | Location: Brazil | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
It depends, do not know your architecture.
But, if it doesn't work, I'll wager you will figure it out...
Good Luck!


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Guru
posted Hide Post
Thanks


WebFOCUS 8.1.05 / APP Studio
 
Posts: 272 | Location: Brazil | Registered: October 31, 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] How to get business days?

Copyright © 1996-2020 Information Builders