Alteryx Designer Discussions

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

General Discussions has some can't miss conversations going on right now! From conversations about automation to sharing your favorite Alteryx memes, there's something for everyone. Make it part of your community routine!

SOLVED

Date to Day ->Parse Error at char(0): Formula: tried to apply numeric operator to string v

Sammie
6 - Meteoroid

Hi

 

Tried to create a column from date to day of the week, the formula should works fine DateTimeformat(DateTimeParse([Date],'%Y/%m/%d'),'%A'); however i'm getting error as below:

 

 

Formula (28) Parse Error at char(0): Formula: tried to apply numeric operator to string value (Expression #2)

 

I've read somewhere could be because previous data is string. The date is extract out using Regex and then convert using DateTime tool. 

 

Can you please help? 

echuong1
Alteryx
Alteryx

Are you able to include a sample of what your data looks like? This will help as it will determine the correct syntax to use. Thanks!

Kenda
14 - Magnetar
14 - Magnetar

Hi @Sammie 

 

Question for you. Is this Date formula the second expression in your formula tool? The error you're getting says that the second expression is the one that needs attention. As an example, in the picture below, the Count variable is the second expression in this formula tool. 

 

Kenda_0-1607546584110.png

 

Hi @Sammie 

 

Is this the second expression in your formula? It seems that you have multiple expressions. A screenshot of your formula tool will help. Cheers!

Sammie
6 - Meteoroid

Hi

 

the data orginally from csv file

 

XT_COMMENTS
Daily PL Adj 07-Dec-2020

And through Regex and DateTime tool - it got extracted and changed to 2020-12-07 heading is Date. In the formula preview, it looks like fine i.e i can see this date showing as Monday. 

 

In fact, what i was trying to achieve is put a formula if the day is Monday, column EOD will be divided by 3, otherwise divided by 1. Is there any easier way just look up using date - knowing is Monday rather than creating a column with Day of the week? 

 

thanks!

Sammie
6 - Meteoroid

Hi @kenda 

 

No, i dont have this! will give a try thanks!

Kenda
14 - Magnetar
14 - Magnetar

@Sammie 

 

Sorry, just to be clear, I wasn't suggesting adding that Count field. I was simply using it as an example to clarify my question. It is important for us to know if your Day field that you're creating is the second expression in your formula tool or not.

echuong1
Alteryx
Alteryx

Try using this to get the day of week: DateTimeFormat([DateTime_Out],"%A")

 

You can use a conditional statement for your calculation. You can next the DOW calc into the second formula, I separated for clarity.

 

echuong1_0-1607547671586.png

 

 

Qiu
16 - Nebula

@Sammie 
This is something interesting or weird.

When I tried to replicated the problem, the input "2020/12/10" was recognized as Int16 by Alteryx, which explains the error you raised.

Then when I tried to see that this Int16 could be with a Select Tool, it changed to String permanently.

This could be some bug, I dont know.

For now the workaround would be to force the data type of input to be a String, I think.

DateTimeformat(DateTimeParse(ToString([Date]),'%Y/%m/%d'),'%A')

1210-Sammie.PNG

Sammie
6 - Meteoroid

Thanks for the help!

 

I think i found the issue it was on my other formula line; i updated some formula didnt realised the data type has been changed. (newbie issue!)

Labels