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     Date difference (Working days)

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Date difference (Working days)
 Login/Join
 
Gold member
posted
Is there a function that one can use find the difference between 2 dates but ommit the weekends i.e. Saturdays and Sundays


Webfocus 7.6.2 on Windows Enterprise 2003 Server and
Webfocus 7.6.2 on HP Unix Server
 
Posts: 74 | Location: London | Registered: January 28, 2005Report This Post
Guru
posted Hide Post
DATEDIF will do it. You must convert both dates to Smart Dates first.
  
DATEDIF(date_one, date_to, 'WD')


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
 
Posts: 391 | Location: California | Registered: April 14, 2003Report This Post
Expert
posted Hide Post
DATEDIF using WD (Weekday):

-SET &DIFF = DATEDIF(20061012, 20061018, 'WD');
-TYPE &DIFF


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, 2005Report This Post
Expert
posted Hide Post
Strangely, the example in the documentation yields the wrong answer:

-SET &DIFF = DATEDIF(19960302, 19970301, 'Y');
-TYPE &DIFF
quote:
DATEDIF calculates the difference between March 2, 1996, and March 1, 1997, and returns a zero because the difference is less than a year
results in 27.


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, 2005Report This Post
Guru
posted Hide Post
Additionally, you can specify workdays by setting up a calendar and holidays according to Chapter 8 in the Functions manual.


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
Guru
posted Hide Post
Setting up the holidays is one I've given up on. We have read and reread Chapter 8. We resorted to an "Include" for the holidays, Has any one set up a "Holidays" file?


Glenda

In FOCUS Since 1990
Production 8.2 Windows
 
Posts: 301 | Location: Galveston, Texas | Registered: July 07, 2004Report This Post
Gold member
posted Hide Post
i am more concerned with capturing the working hours as you may work for 2 hours on Friday and Sat and Sun is not counted, but the function only excludes week ends.


Webfocus 7.6.2 on Windows Enterprise 2003 Server and
Webfocus 7.6.2 on HP Unix Server
 
Posts: 74 | Location: London | Registered: January 28, 2005Report This Post
Guru
posted Hide Post
As to a holiday file. We have set one up, and it works fine.


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
 
Posts: 391 | Location: California | Registered: April 14, 2003Report This Post
Gold member
posted Hide Post
Do you mind leeting me know how to set one up. My email address is adolf.mergulhao@bt.com


Webfocus 7.6.2 on Windows Enterprise 2003 Server and
Webfocus 7.6.2 on HP Unix Server
 
Posts: 74 | Location: London | Registered: January 28, 2005Report This Post
Guru
posted Hide Post
Create a file with a date on each line like this for all your holidays:
20030101
20030217
20030418
Use a text editor or create with a focexec from a data source and hold as format ALPHA.
Call it hdayXXXX.err. Substitute any other 4 characters for XXXX. Remember Unix is case sensitive.
Put the file in .../ibi/srv71/wfs/bin (Unix).
Make sure the permissions allow you to overwrite it (if you are going to update it with focexecs).

In your fex that use it you reference it as
SET HDAY = XXXX

Where XXXX is what you used above.

Schedule your focexec that updates the file in Report Caster to run once a year when your data source is updated.


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
 
Posts: 391 | Location: California | Registered: April 14, 2003Report This Post
Guru
posted Hide Post
Based on the information below, I should be getting a DTDIFF of 5 not 7. Where have I gone wrong?

I have tried it with:

SET HDAY = DOFF
SET HDAY = doff
SET hday = doff


location of holiday file:
/eda53/ibi/srv53/wfs/bin/hdaydoff.err

focexec:
SET HDAY = DOFF
SET BUSDAYS = _MTWTF_
-RUN

TABLE FILE CAR
PRINT
COUNTRY
COMPUTE DAT1/YYMD = 20031220 ;
COMPUTE DAT2/YYMD = 20031231 ;
COMPUTE DTDIFF/I2 = DATEDIF(DAT1, DAT2, 'BD');
END

output:
COUNTRY DAT1 DAT2 DTDIFF
ENGLAND 2003/12/20 2003/12/31 7
JAPAN 2003/12/20 2003/12/31 7
ITALY 2003/12/20 2003/12/31 7
W GERMANY 2003/12/20 2003/12/31 7
FRANCE 2003/12/20 2003/12/31 7


Glenda

In FOCUS Since 1990
Production 8.2 Windows
 
Posts: 301 | Location: Galveston, Texas | Registered: July 07, 2004Report This Post
Guru
posted Hide Post
I don't know. When I run your code, and my Holiday file, I get 5 days DTDIFF.

In my case the XXXX part is a 4-digit number, so I don't have to worry about case.

I would suspect it either can't find or can't read your holiday file.

We used the same set up in WF 5.21- and it worked without change in the upgrade to 7.13.

This message has been edited. Last edited by: N.Selph,


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
 
Posts: 391 | Location: California | Registered: April 14, 2003Report This Post
Expert
posted Hide Post
My holiday file (C:\ibi\srv53\wfs\bin\HDAYDOFF.err) contains:

20031224
20031225
20031226

This fex:

SET HDAY = DOFF
TABLE FILE CAR
PRINT
COUNTRY
COMPUTE DAT1/YYMD = 20031220 ; NOPRINT
COMPUTE DAT2/YYMD = 20031231 ; NOPRINT
COMPUTE DAT1I/I8YYMD = DAT1; NOPRINT
COMPUTE DAT2I/I8YYMD = DAT2; NOPRINT
COMPUTE DAT1X/wDMtYY = DAT1;
COMPUTE DAT2X/wDMtYY= DAT2;
COMPUTE DATEDIF1/I4 = DATEDIF(DAT1, DAT2, 'BD');
COMPUTE DATEDIF2/I4 = YMD(DAT1I, DAT2I);
END

gives me 4 for DATEDIF1 and 11 for DATEDIF2 (I'm not sure why function YMD wouldn't use the holday file).

By the way, if the SET command HDAY couldn't find the file, it would return an error. So, check the contents of the holiday file.


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, 2005Report 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     Date difference (Working days)

Copyright © 1996-2020 Information Builders