Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Malformed Call Function in formula tool

kceesay
7 - Meteor

Hi everyone,

 

I'm getting an error in this formula tool within an IF statement and I'm not sure what's needed to correct the expression. Any ideas?

 

IF Contains([Join Time],'PM' OR 'AM')
THEN [Join Time]
ELSE DateTimeParse([Join Time],"%m/%d/%Y %k",)
ENDIF

6 REPLIES 6
Prometheus
12 - Quasar

@kceesay Can you show an example of what your data looks like coming into the Formula tool?

ed_hayter
13 - Pulsar

Splitting your test clause might help:

 

IF Contains([Join Time], "PM") OR  Contains([Join Time], "AM") THEN ...

kceesay
7 - Meteor

@Prometheus  The column contains data like the below. I want to standardize the formatting.

08/29/2023 03:02:51 PM
08/29/2023 03:15:20 PM
08/29/2023 03:46:57 PM
8/17/2023 9:45
8/17/2023 9:54
8/17/2023 9:54

 

@ed_hayter I tried breaking it up, but I think the issue may be in another part of the expression. I've attached a screenshot. 

ed_hayter
13 - Pulsar

@kceesay try this

 

It parses the date times without AM, PM then wrapped in a datetimeformat to return a string with the same date structure as you already have in your data

 

image.png

Deano478
12 - Quasar

@kceesay you can give this a try:

IF Contains([Join Time], 'PM') OR Contains([Join Time], 'AM')
THEN [Join Time]
ELSE DateTimeParse([Join Time], "%m/%d/%Y %H:%M")
ENDIF



kceesay
7 - Meteor

@ed_hayter That worked thank you so much!

Labels
Top Solution Authors