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     [CLOSED] DATEADD and DATECVT

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] DATEADD and DATECVT
 Login/Join
 
Gold member
posted
When in report caster, the following code is returning an invalid date. When running in MR Dashboard, it's returning correct date value. Does anyone know what could be the problem?

-DEFAULT &ENTER_FROM = '04/01/2009'; //Julian date of this is 109091
-***********************************************************************
-* GET THE CURRENT JULIAN DATE USING GETSALESDATE FUNCTION.
-* IT USES THE &ENTERED_DATE PARAMETER.
-SET &ENTERED_DATE = &ENTER_FROM;
-INCLUDE app/getsalesdate
-IF &LINES EQ 0 THEN GOTO THEEND;
-SET &JUL_FROM= &PDATEJUL; //&PDATEJUL is a value return from getsalesdate.fex
-***********************************************************************
-SET &_FROM_GREG = GREGDT(&JUL_FROM, 'I8YYMD');
-SET &_TEMP_FROM = DATECVT(DATEADD(DATECVT(&_FROM_GREG,'I8YYMD','YYMD'), 'Y', -1), 'YYMD', 'I8YYMD');
-SET &_JUL_PREVFROM = JULDAT(&_TEMP_FROM, 'I7');
-***********************************************************************

This is the log from report caster:
-SET &_FROM_GREG = GREGDT( 109091, I8YYMD );
-SET &_TEMP_FROM = DATECVT(DATEADD(DATECVT(1090401, I8YYMD , YYMD ), Y , -1), YYMD , I8YYMD );
-SET &_JUL_PREVFROM = JULDAT(19001231, I7 ); //in MR dashboard, 19001231 should've been 1080401

This job runs daily in RC. Occasionally, the date function didn't work in RC. However, it works 100% of the time when running in MR dashboard. Any inputs would be greatly appreciated.

Many thanks,

This message has been edited. Last edited by: Kerry,


Shirley Huang
WF 7.7.04M MRE BID DevStudio
WIN2003, SQL Server 2000/DB2
HTML/PDF/EXL2k/AHTML
iSM 6.16
 
Posts: 55 | Registered: May 05, 2006Report This Post
Expert
posted Hide Post
quote:
-SET &_FROM_GREG = GREGDT( 109091, I8YYMD );
Shirley,

I guess this is meant to be a julian date but what is it meant to be (value wise) 2009091? (=1st April 2009). This value is being interpretted as 1090401 as an I8YYMD value (=1st April 109) which is way off the radar and is causing the return from your DATECVT(DATEADD combo to be a zero (invalid output). This in turn is interpretted as being 0 days from the base date which is 31/12/1900.

I cannot understand why this would have ever worked with a value such as 1090401 being passed to the DATECVT function as an I8YYMD.

I would suggest re-evaluating the data you are using for dates and ensure you use full year containers (after all, that was what caused the stir for Year 2000!).

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
The problem seems to arise in getsalesdate, which apparently (judging from the reference to &LINES) uses some Define and Table and finally -READ to set the & vars. If you post it, perhaps we can spot the issue. (Perhaps a data file it references, or its .mas file, differs in RC from that accessible in Dashboard)
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
The problem is a 6-digit Julian date, which is usually 5 or 7, with the 1st byte denoting the century:

 
-SET &JUL_FROM  = 109091;
-SET &CC1       = EDIT(&JUL_FROM,'9');
-SET &CC2       = DECODE &CC1 ( 0 '19' 1 '20' ELSE '21');
-SET &CC3       = &CC2 || EDIT(&JUL_FROM,'$99999');
-SET &FROM_GREG = GREGDT(&CC3, 'I8YYMD');
-TYPE &FROM_GREG
-EXIT


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Master
posted Hide Post
Or simplify it;
-SET &JUL_FROM = 109091;
-SET &JUL_FR=&JUL_FROM +1900000;
-SET &FROM_GREG = GREGDT(&JUL_FR, 'I8YYMD');
-TYPE &FROM_GREG


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report This Post
Gold member
posted Hide Post
I've updated the program to use 7 digit julian dates. I had to convert back to six digit julian date because that's the value in our system, which it's needed for whereclause. It's better performance this way rather than using the define field for whereclause.

Thank you all for the respond. I'll find out tomorrow if it works.

Regards,


Shirley Huang
WF 7.7.04M MRE BID DevStudio
WIN2003, SQL Server 2000/DB2
HTML/PDF/EXL2k/AHTML
iSM 6.16
 
Posts: 55 | Registered: May 05, 2006Report This Post
Virtuoso
posted Hide Post
Shirley:

Do you have an explanation why this code behaves differently "when running in MR Dashboard"?
 
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     [CLOSED] DATEADD and DATECVT

Copyright © 1996-2020 Information Builders