CONVERT DATE&TIME INTO DATE

Hi all,
I’m working with a flow where I need to convert the following string data_arrivo in the following format

yyyy-MM-dd

but, the system crash when find the NULL fields (and option is to replace NULL into today date)

how can I fix this?

thanks to all

regards

image

Hi @Pasquale_p , as your data appears to contain the string “NULL” rather than an actual null (missing) value, one option is to first convert these into actually missing values using Rule Engine, and then you can use String to Date&Time after that

image

The following Rule Engine rule will do as you require.

Normally, the final line of the Rule Engine would be a “catch-all” TRUE => something but by leaving that off, it will result in the default being the creation of a missing value. In this case, any line that doesn’t contain the string “NULL” will be reproduced as-is, meaning that any line that does contain “NULL” will become missing

image

After that a Date&Time to string node can perform the required conversion.

Here is a demo workflow
Convert DateTime with Null in String.knwf (9.5 KB)

4 Likes

Hi @Pasquale_p

@takbb you were faster at replying lol :joy:

@Pasquale_p here a complementary and different solution to the one posted by @takbb:

20230501 Pikairos Replace Null Value by Todays Date.knwf (39.1 KB)

Hope it helps

Best
Ael

4 Likes

Lol @aworker… I was maybe faster but less complete!

I realised after posting that I hadn’t added how to put in today’s date, so I was about to correct my mistake but you have beaten me to that! :wink:

2 Likes

ya ya :smiley:

both work well!!!

3 Likes

the best!

I will learn how do you built!

thanks

I’ve many questions to submit :smiley: :smiley:

2 Likes

That’s a nice trick @takbb ! I usually use the Rule Engine’s TRUE => “”, then use the AutoCast to convert empty strings to missing values… didn’t realize that leaving it to default would save me the double trouble.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.