Warning from Date and time check in Transformer
Posted: Tue Jul 24, 2018 7:20 am
Hi,
I have a file with the below values in one of the date field:
Field_Name : Post_DT
10:00:09
1111:11
14:54:37
09:08:07
20170812
The date column will have both time and date, if I get time then it has to be replaced with current_date while loading into target table and date will be as such, so have wrote this below constraints in Transformer.
Since I'm getting all values in char format in source file, have used stringtodate and stringtotime, The above condition works fine, but I'm getting a warning "Data string was not matching with the format yyyymmdd" for the first 4 values. I believe while checking the date valid condition even though its not matching it throws an warning and moves to the next "if".
had the output like this in table,
2017-08-23
2017-08-23
2017-08-23
2017-08-23
2017-08-12
Can somebody help me to get rid of this warning message?
Thanks..
I have a file with the below values in one of the date field:
Field_Name : Post_DT
10:00:09
1111:11
14:54:37
09:08:07
20170812
The date column will have both time and date, if I get time then it has to be replaced with current_date while loading into target table and date will be as such, so have wrote this below constraints in Transformer.
Code: Select all
If len(Post_DT) = 8 then
If IsValid('Date', StringtoDate(Post_Dt, "%yyyymmdd%")) = 1 then
StringtoDate(Post_Dt, "%yyyymmdd%)
Else If IsValid('Time', StringtoTime(Post_Dt, "%hh:nn:ss%")) = 1 then
Current_Date()
Else SetNull()
Else SetNull()
had the output like this in table,
2017-08-23
2017-08-23
2017-08-23
2017-08-23
2017-08-12
Can somebody help me to get rid of this warning message?
Thanks..