Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
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? 

10 REPLIES 10
echuong1
Alteryx Alumni (Retired)

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
16 - Nebula
16 - Nebula

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
16 - Nebula
16 - Nebula

@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 Alumni (Retired)

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
20 - Arcturus
20 - Arcturus

@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