Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Cloud Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Cloud.
SOLVED

Some datetime values display blank instead of 00. Trying to replace those instances by the same value suffixed with '00' so that all my values end up with the same consistent format: mm/dd/yyy hh:mm:ss.

TrifactaUsers
10 - Fireball

I got a datetime column with format like 5/5/2019 5:37:49. Some of the values display blank when the value is 00, example: 5/5/2019 5:37, when it's actually 5/5/2019 5:37:00. I am trying to replace those instances by the same value suffixed with '00' so that all my values end up with the same consistent format: mm/dd/yyy hh:mm:ss.

I tried using the Replace function but it's not that obvious.

How can I do it?

7 REPLIES 7
Trifacta_Alumni
Alteryx Alumni (Retired)

Hi @RAMZI EL HADDAD?,

 

Based on the examples give, you can try this:

 

replacepatterns col: End with: '$1:00' on: `^([0-9]+\/[0-9]+\/[0-9]+ [0-9]+:[0-9]+/)$`

 

Cheers,

 

Nathanael

TrifactaUsers
10 - Fireball

Thanks @Nathanael Kuipers? . Unfortunately I'm not having the expected result. What this is doing is duplicating the same exact values to the new column. What I need to have is: 4/2/2019 8:20 should be transformed to 4/2/2019 8:20:00. I've attached a screenshot of the result using your suggestion. I'm using Trifacta Pro 5.1, not sure it's any different from the newer versions. Thanks again!

Trifacta_Alumni
Alteryx Alumni (Retired)

The reason is because I was in a rush. If you replace the ` character on either end of the regular expression with / then you should be fine.

TrifactaUsers
10 - Fireball

Hey @Nathanael Kuipers? , no worries.

What do you call regular expression?

replacepatterns col: End with: '$1:00' on: /^([0-9]+\/[0-9]+\/[0-9]+ [0-9]+:[0-9]+/)$/ generates an error

Invalid language syntax cannot be pasted into Transform Builder:

replacepatterns col: End with: '$1:00' on: /^([0-9]+\/[0-9]+\/[0-9]+ [0-9]+:[0-9]+/)$/

 

replacepatterns col: End with: /$1:00/ on: '^([0-9]+\/[0-9]+\/[0-9]+ [0-9]+:[0-9]+/)$'

gives the same result.

 

Please give the complete expression. Thanks.

Trifacta_Alumni
Alteryx Alumni (Retired)

/^([0-9]+\/[0-9]+\/[0-9]+ [0-9]+:[0-9]+)$/

TrifactaUsers
10 - Fireball

Working! Many thanks @Nathanael Kuipers? 

TrifactaUsers
10 - Fireball

Here is the right function: replacepatterns col: End with: '$1:00' on: /^([0-9]+\/[0-9]+\/[0-9]+ [0-9]+:[0-9]+)$/