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?
Solved! Go to Solution.
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!
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.
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!
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!
Hi @kenda
No, i dont have this! will give a try thanks!
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.
@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')
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!)