Skip to main content
Question

DateTimeConverter Rejected Port NULL

  • May 1, 2019
  • 5 replies
  • 168 views

Hi im using DateTimeConvertor to convert the date format into this format YYYYMMDD. It is working fine but the problem is some features coming out of the Rejected port of the DateTimeConverter have had the date attribute values replaced with NULL. How do I resolve this issues?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

redgeographics
Celebrity
Forum|alt.badge.img+59
  • Celebrity
  • 3699 replies
  • May 1, 2019

Hmmm... It appears it nulls any input that couldn't be converted. I'm not sure if that's the "right" way to do it. @mark2atsafe can you weigh in on this?

A quick workaround would be to use the StringSearcher before the DateTimeConverter to check whether it matches the expected input format.


  • Author
  • 2 replies
  • May 1, 2019

Hmmm... It appears it nulls any input that couldn't be converted. I'm not sure if that's the "right" way to do it. @mark2atsafe can you weigh in on this?

A quick workaround would be to use the StringSearcher before the DateTimeConverter to check whether it matches the expected input format.

@redgeographics thank for answering. Im' stil new to fme so i dont really know how to use the StringSearcher. Can you give me some example on how to use it?


redgeographics
Celebrity
Forum|alt.badge.img+59
  • Celebrity
  • 3699 replies
  • May 2, 2019

@redgeographics thank for answering. Im' stil new to fme so i dont really know how to use the StringSearcher. Can you give me some example on how to use it? 

Have it search in the attribute that holds your date and set the regular expression to

\d{4}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])

Do keep in mind that this will only match the correct date format: so 4 digits for the year, then 2 (which can not be over 12) for the month and 2 (which can not be over 31) for the day. It will not check wether it's actually a valid date. If you put in 20190231 it will say that's ok.

I've set up an example workspace, run it with prompting for user parameters and then enter a date in YYYYMMDD format (or not) and see how it gets processed.

0684Q00000ArNDjQAN.png

date_example.fmw


mark2atsafe
Safer
Forum|alt.badge.img+56
  • Safer
  • 2554 replies
  • May 21, 2019

I think that in FME2019 the transformer has an option to ignore nulls. However, the date input format has to be set correctly to match the data. If not - or a feature doesn't match - then the feature will exit the rejected port with date set to null. If it happens to every feature then it's likely the input format is not correct.


revesz
Contributor
Forum|alt.badge.img+21
  • Contributor
  • 122 replies
  • May 22, 2019

My workaround:

  1. Create a "backup" copy of the date/time attribute
  2. Push through the DateTimeConverer
  3. Copy back the "backup" to the original attrib on the rejected port.