Alteryx Designer Desktop Discussions

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

Changing type using Multi-field formula? (Or other tools)

OF_Kimbo
6 - Meteoroid

Hi all,
I am trying to change the type of the data in certain columns of my table, it the most dynamic way.

My table looks like this: (sorry I’m typing from the phone)

 

| Name | Cause | Date1           | Con1 | Date2          | Con2 |

| Joe     | sport   | 2020-03-12 | 15      | 2020-04-16 | 32      |

 

all the rows are similar. No patterns, nothing special, just records. The number of columns DateN and ConN is variable, generated through a dynamic workflow, that’s why I am looking for a dynamic solution.

 

Now, all the values are V_String, and I need a formula that ‘identifies’ the column (Contains should do the job) and replace/assign/edit the Type of the data in that column.

Specifically: DateN should have date format (yyyy-mm-did) and the ConN should be Double (with two decimals).

 

Do you have any idea how to do it with formulas? Or with any other tool?

Thank you all.

11 REPLIES 11
geraldo
13 - Pulsar

@OF_Kimbo 

 

the auto-field tool doesn't answer your request?

Did you get to test it?

geraldo_0-1683830202139.png

 

OF_Kimbo
6 - Meteoroid

Hi, thank you for your answer.

I have tried the auto field, but it only recognizes the first Date and the first Con. 
The others remain unchanged as V_String.

RobertOdera
13 - Pulsar

Hi, @OF_Kimbo 

 

Kindly consider the below as a starting point - I hope you find it helpful. Cheers!

RobertOdera_0-1683837035497.png

 

geraldo
13 - Pulsar

@OF_Kimbo 

 

 

An attached example datatype change workflow

 

Here steps for changing data types

geraldo_0-1683846216912.png

 

Yoshiro_Fujimori
15 - Aurora

Hi @OF_Kimbo ,

 

Have you considered using Auto Field tool?

It sounds to me that the tool is designed for your case.

 

Auto Field tool will convert a column with all the data in "yyyy-mm-dd" format to Date type,

and a column with all the data in Integer to Int, etc.

 

https://help.alteryx.com/20223/designer/auto-field-tool

https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Knowledge-Base/Tool-Mastery-Auto-Field/ta-...

 

If there are any exceptional data, you may need to consider other way.

OF_Kimbo
6 - Meteoroid

Hi @RobertOdera

Thank you for your answer.

I tried it and despite being an elegant solution, unfortunately, when you look at the MetaData of your output (and mine) they are still "V_String".

It seems that the formulas can't force the type to change.

 

Yoshiro_Fujimori
15 - Aurora

@OF_Kimbo 

 

Are you talking about my proposal to use Auto Field tool?

On my PC, the output anchor of Auto Field tool shows the data types properly converted as below. (There's no V_String type.)

Yoshiro_Fujimori_0-1683882238158.png

Please let me know which output you are referring to.

OF_Kimbo
6 - Meteoroid

@Yoshiro_Fujimori

 

No, I was referring to the solution provided by RobertOdera.

 

I also tried your solution, but it seems that only for the first two columns it works...

 

OF_Kimbo_0-1683882773020.png

 

Yoshiro_Fujimori
15 - Aurora

@OF_Kimbo 

 

That's interesting.

Do you check all the fields you want to change the type in Auto Field configuration?

Yoshiro_Fujimori_0-1683883544219.png

 

Labels