Focal Point
[SOLVED] Convert character (A8) to date format

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5327029786

October 03, 2017, 02:45 PM
John Coleman
[SOLVED] Convert character (A8) to date format
I am in Oracle 11g and working with AppStudio 82.

One for the date fields comes in from Oracle as a YYYYMMDD in character format, but I need to convert it to a date field in AS.

Is there a function i can't find that might do this for me?

This message has been edited. Last edited by: FP Mod Chuck,


John Coleman
WEBFocus 8.1.05
Windows 7
October 03, 2017, 03:20 PM
jcannavo
You could try HINPUT...

https://webfocusinfocenter.inf...ng/source/hinput.htm


JC
WebFOCUS Dev Studio / App Studio
8.2.01
Windows 7
October 03, 2017, 03:26 PM
John Coleman
Than you. I should have said that in the post. I tried that but it was so poorly un-optimized that I couldn't go forward with it in production. I'll keep poking. Thank you for your answer though!


John Coleman
WEBFocus 8.1.05
Windows 7
October 03, 2017, 03:33 PM
MReeder
Have you tried to convert using DATECVT instead? It works for date only and does not require the time portion to be in the date. might work better.

https://webfocusinfocenter.inf...9b-B343-9B01F25A24F0

you could always just convert it to an integer of I8YYMD.


WebFOCUS 8.2.02M
Windows
Server/8.2.02M
All Outputs
October 03, 2017, 03:37 PM
Francis Mariani
How are you using the function? I assume it's in a DEFINE, therefore applies to every row. Try it in a COMPUTE, it will then be applied to the answer set.


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
October 09, 2017, 04:53 AM
Frans
or if you're using it in a filter, the SQL is probably not optimized. Could you post the code to have a better understanding?


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
October 09, 2017, 11:58 AM
eric.woerle
John,

Another option if you are concerned with inefficiencies from WF would be to create a virtual field on the table in Oracle and do the conversion there. That way you aren't worrying about creating a define every time. then in the masterfile make sure the Actual value is date and usage is YYMD. Then your all set.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2