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     converting 20071108 to a Date?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
converting 20071108 to a Date?
 Login/Join
 
Master
posted
I'm not sure where to look for information on this...

I'd like to convert a numeric field to a webfocus date in a compute/define. It's 8 digits, YYYYMMDD.

What function does this? Is there something simple like oracle's to_date? Or do I have to typecast to a string, substr out the year, month and date seperately then feed them back into a function or something?

Thanks!


Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
 
Posts: 611 | Registered: January 04, 2007Report This Post
Expert
posted Hide Post
WebFOCUS Dates are a pain - a whole book has been written on the subject.

TABLE FILE CAR
PRINT COUNTRY
COMPUTE DT1/I8 = 20071125; NOPRINT
COMPUTE DT2/I8YYMD = DT1; NOPRINT
COMPUTE DT3/YYMD = DT2;
END


DT1 is your numeric date. DT2 is the numeric date with a date format. DT3 is the date formatted field. You can do this in a DEFINE or a COMPUTE.

You can go further and convert this to a Date-Time field.


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
Date-Time:
TABLE FILE CAR
PRINT COUNTRY
COMPUTE DT1/I8 = 20071125; NOPRINT
COMPUTE DT2/I8YYMD = DT1; NOPRINT
COMPUTE DT3/YYMD = DT2;
-*COMPUTE DT4/HYYMDS = DT3;
COMPUTE DT5/A14 = EDIT(DT2) | '000000';
COMPUTE DT6/HYYMDS = HINPUT(14, DT5, 8, 'HYYMDS');
END


You would think that the compute for DT4 would work - you want to convert a date field into a date-time field, but it doesn't work - that would be too easy.


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
quote:
TABLE FILE CAR
PRINT COUNTRY
COMPUTE DT1/I8YYMD = 20071125; NOPRINT
COMPUTE DT3/YYMD = DT1;
END


For just the date, it is a simple equality. I used Francis' example and eliminated one COMPUTE.

And, as Francis also showed, date-time is a bit more convoluted.


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
Expert
posted Hide Post
You can't eliminate the compute if there is already a numeric field that needs to be converted to a date field. The existing field has to be converted to an I8YYMD field before being converted to a date field.


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
quote:
DATE_X/YYMD = DATECVT(&YYMD, 'I8YYMD', 'YYMD');


Yes, that would be lovely.

TABLE FILE CAR
PRINT COUNTRY
COMPUTE DT1/I8 = 20071125; NOPRINT
COMPUTE DATE_X/YYMD = DATECVT(DT1, 'I8YYMD', 'YYMD');
END


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
Francis, never to old....

Did you read that book?




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
Master
posted Hide Post
good work. thanks!


Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
 
Posts: 611 | Registered: January 04, 2007Report This Post
Expert
posted Hide Post
Frank, I will read that book on my next trip on the Titanic.


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
Gold member
posted Hide Post
I find it intersting that everyone seems to be obsessed with using the integer date to begin with and then converting to a smart-date, or if need be, directly to the date-timestamp using the DT function?

Why not go directly to the smart-date?

TABLE FILE CAR
SUM COMPUTE MYSMARTDATE/YYMD = '20071108';
COMPUTE MYDATESTAMP/HYYMDS = DT(20071108);
BY COUNTRY
END



Windows: WF 7.6.2: SQL Server 2008 R2
 
Posts: 86 | Location: Chicago | Registered: August 03, 2007Report This Post
Expert
posted Hide Post
Well, the original question did start with "I'd like to convert a numeric field to a webfocus date".

If you have a field in a table (that you cannot modify, or modify the master for) that contains a date, but is defined as a numeric field, you would have to do what we've been talking about here.


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
Ah yes, another day, another OJ trial.


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
Gold member
posted Hide Post
Ahhh, it does help to pay a little more attention to the origional question.

And, uhhh, OJ was never in that hotel - it's all a setup Music



Windows: WF 7.6.2: SQL Server 2008 R2
 
Posts: 86 | Location: Chicago | Registered: August 03, 2007Report This Post
Gold member
posted Hide Post
Tom

I'ts easy...
-SET &STR = EDIT(&YYMD,'$$$$9999') || EDIT(&YYMD,'9999');
DEFINE FILE CAR
MYDATE/MDYY = '&STR';
END
TABLE FILE CAR
SUM MYDATE/YYMD
BY COUNTRY
END
  



Windows: WF 7.6.2: SQL Server 2008 R2
 
Posts: 86 | Location: Chicago | Registered: August 03, 2007Report This Post
Master
posted Hide Post
I wonder why all the webfocus fuctions are so complicated.

It took me 5 minutes to figure out how to use trim. I've never seen a trim function, in any language, with as many parameters.


Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
 
Posts: 611 | Registered: January 04, 2007Report This Post
Expert
posted Hide Post
I agree. I don't know why the length of the string to be manipulated needs to be passed - the function should be able to figure that out, that's how it's done in almost all the other languages I've worked with.


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
Keeps it interesting. Wink


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Master
posted Hide Post
tom flynn, is that fancy speak for don't talk smack?


Prod: Single Windows 2008 Server running Webfocus 7.7.03 Reporting server Web server IIS6/Tomcat, AS400 DB2 database.
 
Posts: 611 | Registered: January 04, 2007Report This Post
Master
posted Hide Post
Well it looks like another runaway thread. I just do not understand, if someone ask for help and someone suggest a soluation and it works even thought it can be done differently without any performance gain. Then way does everyone have to try and show up some else. Maybe it is just to get there karma increased I don't know, but I got another point. Big Grin




Scott

 
Posts: 865 | Registered: May 24, 2004Report This Post
Expert
posted Hide Post
Never mind, it'll soon be Miller time again ...... Eh Prarie?
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
Yep......


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 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     converting 20071108 to a Date?

Copyright © 1996-2020 Information Builders