Focal Point
[SOLVED] Business days Function - TWO DIFFERENT WORK DAYS IN SAME FEX

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1147067476

February 17, 2015, 04:14 PM
FOCdeveloper
[SOLVED] Business days Function - TWO DIFFERENT WORK DAYS IN SAME FEX
Hi
I have a function that gives me work days when there are 6 work days (m-sat) . Worked fine. But Now I need to add 3 Work days (m-w-f) for of the locations..

I duplicated the function with setting business days different , but it gives me only work days based on 6 days a week. For example, November 2013, it gives 21 days for both functions..

Can anyone see what the problem is here.. I looked at it and can't figure out, why it is taking 6 work days and not 3 Work day week..
here is the code

Thanks
  
-*-******************************************************************************
-*-* Find mon-sat days in a month - (6 days a week)
-*-******************************************************************************
SET BUSDAYS = _MTWTFS;
DEFINE FUNCTION WD_MON6 (year/I4,month/I2)
6this_iyym/I6YYM = (year*100)+month;
6bom_yymd/YYMD = 6this_iyym;
WD_MON6/I2 = DATEDIF(6bom_yymd,DATEMOV(6bom_yymd,'EOM')+1,'BD');
END
-RUN
-*-******************************************************************************
-*-* Find mon-WED-FRI days in a month - (3 days a week)
-*-******************************************************************************
SET BUSDAYS = _M_W_F_;
DEFINE FUNCTION WD_MON3 (year/I4,month/I2)
3this_iyym/I6YYM = (year*100)+month;
3bom_yymd/YYMD = 3this_iyym;
WD_MON3/I2 = DATEDIF(3bom_yymd,DATEMOV(3bom_yymd,'EOM')+1,'BD');
END
-RUN

This message has been edited. Last edited by: <Kathryn Henning>,


Prod/Dev/Test: WF 8.1.5 on (Windows Server 2012 R2 )
SandBox: WebFocus Server 8.1.5 on Windows Server 2008 R2
WebFOCUS App Studio 8.1.5 and Developer Studio 8.1.5 on Windows 7
February 17, 2015, 04:39 PM
Francis Mariani
The code you shared with us DEFINES the functions.

You need to set the business days (SET BUSDAYS = _M_W_F_) just before you CALL the function.


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
February 17, 2015, 04:53 PM
FOCdeveloper
Thanks Francis
I have the SET BUSDAYS = _M_W_F_ before each function starts.. (see previous code here) then I have my source file Defined
in the Define then I figure out week days based on the location, if the Location has 3 days, use the WD_MON3 function and if the location has 6 days, use the WD_MON6 function
See sample below
  
DEFINE FILE LOCTABLE 
WEEKDAYS1/I2 = IF LOCWD EQ 3 THEN WD_MON3(GLYR1,GL_MTH1) ELSE
               IF LOCWD EQ 6 THEN WD_MON6(GLYR1,GL_MTH1) ELSE 0;
END



Prod/Dev/Test: WF 8.1.5 on (Windows Server 2012 R2 )
SandBox: WebFocus Server 8.1.5 on Windows Server 2008 R2
WebFOCUS App Studio 8.1.5 and Developer Studio 8.1.5 on Windows 7
February 17, 2015, 05:29 PM
FOCdeveloper
I will have to separate my defines, hold and then join to get what I need..

Thanks


Prod/Dev/Test: WF 8.1.5 on (Windows Server 2012 R2 )
SandBox: WebFocus Server 8.1.5 on Windows Server 2008 R2
WebFOCUS App Studio 8.1.5 and Developer Studio 8.1.5 on Windows 7
February 19, 2015, 12:25 PM
linus
Remove the semi-colon at the end of your set -- I didn't test but maybe your BUSDAYS aren't really being set due to the semi-colon.
SET commands don't get semi-colons
-SET commands get semi-colons.


WF 7.7.05
HP-UX - Reporting Server, Windows 2008 - Client, MSSQL 2008, FOCUS Databases, Flat Files
HTML, Excel, PDF
February 25, 2015, 04:13 PM
FOCdeveloper
Thanks Linus
I had tried that, but as I indicated above, I got it done, keeping it separate

Thanks


Prod/Dev/Test: WF 8.1.5 on (Windows Server 2012 R2 )
SandBox: WebFocus Server 8.1.5 on Windows Server 2008 R2
WebFOCUS App Studio 8.1.5 and Developer Studio 8.1.5 on Windows 7