Focal Point
[CLOSED] Convert date time variable in data flow

This topic can be found at:
http://forums.informationbuilders.com/eve/forums/a/tpc/f/1381057331/m/6177061976

November 02, 2015, 09:29 AM
David Nguyen
[CLOSED] Convert date time variable in data flow
I have a variable &myDate in A19V format that stored a date time value such as: "2015/10/29 07:00:00".

If using a DBMS SQL flow for Oracle database, I can read and format the variable like this:
SELECT ....
FROM ....
WHERE TIME_MODIFIED <= TO_DATE ['&myDate', 'YYYY/MM/DD HH24:MI:SS')

Using a regular data flow, I cannot use the function TO_DATE to format the variable. What function should I use in iWay dataflow to format the '&myDate' variable from A19V to datetime format HYYMDS?

Thanks for your suggestion.

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


iWay Data Migrator v7704M
Windows, All Outputs
November 03, 2015, 09:09 AM
Tom Flynn
Try using this SQL Function:
WHERE TIME_MODIFIED <= to_timestamp('&myDate', 'yyyy/mm/dd hh24:mi:ss')
  

"MAY" have to do it this way:
WHERE TIME_MODIFIED <= to_timestamp('&myDate.EVAL', 'yyyy/mm/dd hh24:mi:ss')
  

BTW
1. it is a left parenthesis ('&myDate' - NOT a left bracket ['&myDate'
2. &myDate is not A19V, it is a text string...


Tom Flynn
WebFOCUS 7.7.05 - PROD/QA
DB2 - AS400 - Mainframe
November 03, 2015, 09:52 AM
David Nguyen
Hi Tom,
Thanks a lot for your suggestion.

I receive the following when running:
(FOC14067) STATEMENT CONTAINS UNKNOWN SCALAR FUNCTION 'to_timestamp' ON LINE 28

Please note that my question is to be used in a regular flow not a DBMS SQL Flow.
In a DBMS Flow, I can use TO_DATE, TO_TIMESTAMP. However, I would like to use a regular flow.

About your reminder:
1. Somehow when copying the code to the forum, the left parenthesis is replaced by [
2. &myDate is stored in a flat file and has format A19V. It is passed into the flow using the "Get parameter using synonym".


iWay Data Migrator v7704M
Windows, All Outputs
November 03, 2015, 11:14 AM
Tom Flynn
Hi David,
Have no idea the difference, don't know IWAY, just know WebFOCUS.

Try this then, with or without quotes:
  
WHERE TIME_MODIFIED <= DT(&myDate);



Tom Flynn
WebFOCUS 7.7.05 - PROD/QA
DB2 - AS400 - Mainframe
November 03, 2015, 04:01 PM
David Nguyen
Tom,
That doesn't work either. I received the same error:

(FOC14067) STATEMENT CONTAINS UNKNOWN SCALAR FUNCTION 'DT' ON LINE 28


iWay Data Migrator v7704M
Windows, All Outputs
November 04, 2015, 07:02 AM
Tom Flynn
Hi David,
Can't guess anymore. Maybe someone else can assist.
Might post your code between the code tags on the toolbar </>
Tom


Tom Flynn
WebFOCUS 7.7.05 - PROD/QA
DB2 - AS400 - Mainframe
November 05, 2015, 04:21 AM
kmvgt
I had same type of issue but in different way. But this solution worked for me I just made the &val/HYYMDS. And then the rest. May this would be help ful. Let us know whether it worked or not for you.


Webfocus 8104
Windows 7
November 11, 2015, 10:41 AM
Clif
In the current production release 7.7.06 there are at least three other ways to convert a character string to a timestamp.

In a Source Transformation (FOCUS DEFINE) us the FOCUS function:
TS/HYYMDS=HINPUT( 19, '&MYDATE', 8, 'HYYMDS' )  

In a Source Transformation or SELECT statement invoke the ORACLE database function:
DB_EXPR(to_timestamp('&MYDATE', 'yyyy/mm/dd hh24:mi:ss'))

In a SELECT statement use the simplified function:
TIMESTAMP('&MYDATE' )

This does beg the question as to why are you still using 7.7.04? It was first release 3 1/2 years ago in April 2012 and it's scheduled to functionally stabilized at the end of December 2015. That's next month.

One way to do this in older releases (albeit with restrictions on non APT queries) is to use SQL. which is the less functional predecessor of DB_EXPR to call a database function:
SQL.TO_DATE('&MYDATE' , 'YYYY/MM/DD HH24:MI:SS' )   

November 12, 2015, 10:30 AM
David Nguyen
Tom, Kmvgt and Clif,
Thanks a lot for your suggestion.

I've try all of your suggestions in a regular data flow but it still doesn't work. As a workaround, I use a DBMS SQL Flow for now .

We are waiting on management decision to upgrade to new iWay version.

Thanks again for your help.


iWay Data Migrator v7704M
Windows, All Outputs