Alteryx Designer Desktop Discussions

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

Adding two different data types in one column

jjhan0630
6 - Meteoroid

I'm trying to add two different data types in one column. 

캡처.PNG

 

For instance, I'm trying to use Multi raw formula to add times(column 12~7) to the dates in the same column. I know that Alteryx does not provide to different data types in one filed. 

How should I solve this?

 

4 REPLIES 4
apathetichell
18 - Pollux

Your columns will already be considered to be strings because they contain different types of data inside of them.

 

You can use [a]+[b] or [a]+" "+"[b] if you want to include a space.

 

If you want to convert them out to non-string types you can use todate()/tonumber() as needed and then perform calculations specific to that field, but keep in mind that your final product must be a string (or an error) if you are including different types of data in your column.

 

You can use a formula to do something like if regex_match([b],"\d+") then tonumber([b]) else null() endif - and then use a summarize on the resulting new column to get the sum of rows 1-7 - if that's what you are trying to do. Likewise you can create a date column by testing which entries include a date  (the regex match for a date could be \d{4}-\d{3}-d{3}) and then use date time functions with the new information.

 

It's probably be easier to keep unlike data in separate columns and then have formulas combine them as needed.

Qiu
20 - Arcturus
20 - Arcturus

@jjhan0630 

As you said, only one data type is supported for one column.

So they will all have to be string.

jjhan0630
6 - Meteoroid

Thank you for your response.

The problem here is that I need final column output to be datetime format.

 

I'm getting an error when adding numbers to the date because the column is already in datetime format. 

apathetichell
18 - Pollux

yes - so what you need to do is keep the numbers in a separate column and then use datetimeadd([date],x,"minutes")

 

If my hunch of what you are looking to is correct - you'd breakout rows 1-7 into integers via the if/regexmatch/ then tonumber([column b] strategy and then use a summarize tool to get the number of minutes you need to add (if you want a total)...

 

Once you have the minutes you append that back to your datasource (as an integer) and then use datetimeadd with your date in one column and your integer in another. new final column is datetime.

Labels