Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Business days Function - TWO DIFFERENT WORK DAYS IN SAME FEX
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Business days Function - TWO DIFFERENT WORK DAYS IN SAME FEX
 Login/Join
 
Platinum Member
posted
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
 
Posts: 126 | Location: USA | Registered: August 21, 2008Reply With QuoteReport This Post
Expert
posted Hide Post
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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Platinum Member
posted Hide Post
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
 
Posts: 126 | Location: USA | Registered: August 21, 2008Reply With QuoteReport This Post
Platinum Member
posted Hide Post
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
 
Posts: 126 | Location: USA | Registered: August 21, 2008Reply With QuoteReport This Post
Platinum Member
posted Hide Post
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
 
Posts: 149 | Location: Dallas, TX | Registered: June 08, 2007Reply With QuoteReport This Post
Platinum Member
posted Hide Post
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
 
Posts: 126 | Location: USA | Registered: August 21, 2008Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Business days Function - TWO DIFFERENT WORK DAYS IN SAME FEX

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.