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     Next Business Day functions not always working

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Next Business Day functions not always working
 Login/Join
 
Member
posted
I’m trying to use the next business day functions in Dialog Manager and am getting very erratic results. The following code will be working just fine but then suddenly start returning 19001231 after making a seemingly insignificant change like adding another -SET line. I can undo the change I made but the NBD functions remain "corrupted".

-DEFAULT &INPUTDATE = &YYMD
SET BUSDAYS = _MTWTF_
SET HDAY = 2008

-SET &_RUNDATE = &INPUTDATE.EVAL;
-SET &_CURRENT_BUSINESS_DAY = DATECVT(DATEADD(DATECVT(&_RUNDATE,'I8YYMD','YYMD'), 'BD', 0), 'YYMD', 'I8YYMD');
-SET &_NEXT_BUSINESS_DAY_BD = DATECVT(DATEADD(DATECVT(&_RUNDATE,'I8YYMD','YYMD'), 'BD', 1), 'YYMD', 'I8YYMD');
-SET &_NEXT_BUSINESS_DAY_NBD = DATECVT(DATEMOV(DATECVT(&_RUNDATE,'I8YYMD','YYMD'), 'NBD'), 'YYMD', 'I8YYMD');

-TYPE RUNDATE = &_RUNDATE
-TYPE CURRENT_BUSINESS_DAY = &_CURRENT_BUSINESS_DAY
-TYPE NEXT_BUSINESS_DAY_BD = &_NEXT_BUSINESS_DAY_BD
-TYPE NEXT_BUSINESS_DAY_NBD = &_NEXT_BUSINESS_DAY_NBD

When it works returns..

RUNDATE = 20080129
CURRENT_BUSINESS_DAY = 20080129
NEXT_BUSINESS_DAY_BD = 20080130
NEXT_BUSINESS_DAY_NBD = 20080130

When it stops working returns..

RUNDATE = 20080129
CURRENT_BUSINESS_DAY = 19001231
NEXT_BUSINESS_DAY_BD = 19001231
NEXT_BUSINESS_DAY_NBD = 19001231

As suddenly as it stops working it may suddenly start working again. Sometimes after a copy and paste into a new FEX. Other times after an hour. Other times the next day.. etc. Very strange.

-Dave


WebFOCUS version 761.
Windows operating system. SQL Server database.
Output: Currently creating Excel and PDF report output.
 
Posts: 14 | Registered: December 14, 2007Report This Post
Virtuoso
posted Hide Post
Sounds as if you are running into a caching issue in the browser. What happens if you do and empty cache in the browser?

Is the input coming from the 'calendar' input, if so what are the defaults set in it.


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Expert
posted Hide Post
Firstly, you cannot assign a defaul variable value of a variable -

-DEFAULT &INPUTDATE = &YYMD

Secondly, what is happening is that the input date value being passed to your DM functions is invalid and therefore returning 0 which equates to the base date, which for WebFOCUS is 31/12/1900.

Even though your displayed output shows that the date input was 20080129 the DATEMOV and DATECVT functions consider it an invalid date. Remove the allocation of your holiday file and test the failing version to see what results you get.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
This does look a bit buggy, or maybe not supported. The issue is with the holiday file and DM.

If you take the holiday file away, the code will work, add the holiday file in and the first run will work, (ignoring the holiday file) and any subsequent run will fail until the server is restarted or the process uses a different agent.

In reporting it is fine.

Tony, I would think that using
-DEFAULT &INPUTDATE = &YYMD
would be acceptable with DM, though I would generally use
-DEFAULT &INPUTDATE = &YYMD.EVAL
Is that not legal?


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Expert
posted Hide Post
Alan,

I'm sure there was a discussion on defaulting a variable to another variable. I'm sure it works in some situations, but is it documented and supported? Who knows? I'm sure Francis will chip in any moment (or at least when the sum reaches Canada Wink) as regards documented or not.

Myself, I've had mixed results with this type of code and many moments of sanity checking when I think "I am sure this worked last time!".

But as we all know, as time goes by the grey cells deteriorate whilst the grey hair grows. Myself I prefer to think of grey hair as a change of pigmentation Wink

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Master
posted Hide Post
Personnaly, I wouldn't use the -DEFAULT with another & variable. The reason is, is that after the -DEFAULT runs, in this case, the contents of &INPUTDATE is &YYMD not the contents of &YYMD. Hence the need to use .EVAL on the -SET &_RUNDATE.

I took the -DEFAULT out and ran this through using every holiday in 2008 along with several weekend days and it works just fine, every time.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Virtuoso
posted Hide Post
In which case it looks as though there is a bug in 7.6, as this definitely fails in 7.6 but jgelona has it working in 7.1.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Member
posted Hide Post
I had a similar problem recently. The following code:

SET HDAY = 2008
SET BUSDAYS = _MTWTF_
-SET &YYMD = 20080102;
-SET &CDATA =DATECVT(&YYMD ,I8YYMD,YYMD);
-SET &TDATE1 = DATEMOV(&CDATA, 'PBD');
-SET &CUR_BUS_DATE =DATECVT(&TDATE1 , YYMD, I8YYMD);
-SET &TDATE2 = DATEMOV(&CDATA, 'NBD');
-SET &NEXT_BUS_DATE =DATECVT(&TDATE2 , YYMD, I8YYMD);

If your calculation is going beyond the year 2008, add the next year or the previous years holidays to your holiday file.

Hope this helps.
 
Posts: 18 | Registered: April 10, 2006Report This Post
Virtuoso
posted Hide Post
Jenny

Please update your signature so we know what version you are using.

Your code also fails in 7.6.4


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Member
posted Hide Post
Alan,

Thanks for the advice. We killed all agents using the server console and the code suddenly worked the first time we ran it. Each subsequent run fails until we kill the agent again. It also now seems to ignore our holiday file as well.

-Dave

This message has been edited. Last edited by: 3RDCC,


WebFOCUS version 761.
Windows operating system. SQL Server database.
Output: Currently creating Excel and PDF report output.
 
Posts: 14 | Registered: December 14, 2007Report This Post
Virtuoso
posted Hide Post
Dave

I would open a case with IB.

Running this DM code twice on the same agent causes it to fail, also the dates in the holiday file are being ignored.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Member
posted Hide Post
Thanks Alan. We will do just that.


WebFOCUS version 761.
Windows operating system. SQL Server database.
Output: Currently creating Excel and PDF report output.
 
Posts: 14 | Registered: December 14, 2007Report This Post
Member
posted Hide Post
James Miranda from our Information Builders Customer
Support IRT group has provided the following update on 02/05/2008
at 04:34PM.

David,

You issue was that you just needed to add a -RUN after your two SET statments.

-SET &ECHO=ALL;
-DEFAULT &INPUTDATE = &YYMD.EVAL
SET BUSDAYS = _MTWTF_
SET HDAY = 2008
-RUN

Sincerely,
Jim


The -RUN did the trick!!

Thanks Jim,

-Dave


WebFOCUS version 761.
Windows operating system. SQL Server database.
Output: Currently creating Excel and PDF report output.
 
Posts: 14 | Registered: December 14, 2007Report This Post
Member
posted Hide Post
Just wanted to bump this post and say thanks as well, the -RUN after setting the HDAY fixed the DATEDIF problem (for 'BD').


______________________
WF Version: Prod/Test : WebFOCUS 7.67; ETL 7.67

OP system: WIN2K
 
Posts: 18 | Registered: June 28, 2006Report This Post
Expert
posted Hide Post
As far as I can tell, you can never have too many -RUN statements.

One of us should have noticed the original code posted by 3RDCC needed a -RUN after the non-Dialogue Manager code SET HDAY...


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
Virtuoso
posted Hide Post
Yes Francis, but in January who was a real Virtuoso....LOL

I still don't see the reason for that RUN command unless I follow your statement ...
RUN after the SET commands as a default ?




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Expert
posted Hide Post
Frank,

I'm not a believer in too many -RUN commands but if you have a situation where you have DM commands followed by WF commands followed by DM commands that make use of something created by the WF commands, then because of the way that the parsing is done, you need to put the -RUN after the WF commands so that they are executed before the second set of DM commands.

Does that make it clearer?


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Virtuoso
posted Hide Post
RUN

Clear the stack of all commands to that point and start anew.

Trouble with being an interpretive language. First error hit it dies, clean it up and get another and so on. It is still a great tool though.


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Virtuoso
posted Hide Post
Tony A wrote:
quote:
Firstly, you cannot assign a default variable value of a variable -

-DEFAULT &INPUTDATE = &YYMD


Actually you can (which can sometimes be usefull); that part of Dave's code was fine all along.

Try executing

-DEFAULT &_INPUTDATE = &YYMD
-SET &_RUNDATE = &_INPUTDATE.EVAL;
-? &_

It displays

CURRENTLY DEFINED & VARIABLES STARTING WITH '_':
&_INPUTDATE = &YYMD
&_RUNDATE = 20080722

-DEFAULT (unlike -SET) does not perform substitution on the RHS. The &YYMD is treated as a literal.

But the .EVAL in Dave's
-SET &_RUNDATE = &INPUTDATE.EVAL;
makes up for that, by causing a two-stage evaluation:

The first phase (triggered by .EVAL) rewrites the statement as
-SET &_RUNDATE = &YYMD;
based on the character value of &INPUTDATE

The second phase executes that, and the normal operation of -SET resolves the & variable reference on the RHS -- so in effect you have (say)
-SET &_RUNDATE = 20080722;


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 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     Next Business Day functions not always working

Copyright © 1996-2020 Information Builders