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

Dynamic Field type

Nidhin
8 - Asteroid

Hi

 

Is there a way to set all the fields as V_String ?

I will be using this in a batch Macro and the field names will change for each data set.

I know doing this will cause Alteryx to allocate more memory,but i am working on  data comparison workflow and will need to compare the field.

When Alteryx is setting the field type automatically, field type is having mismatch causing the formula tool to through error.

 

Eg: In data set 1 Field "ABC" might be set as V_String,but in data set 2 Field "ABC" is being set as Double as the entire column is empty.I want both these fields to be set as V-String.and in each run this can change.So i want a dynamic option. Basically to set all the fields being passed to the Macro as V_string

 

Thanks

Nidhin

5 REPLIES 5
BenMoss
ACE Emeritus
ACE Emeritus
Hi!

Strangely enough this is something you can do easily with the multi-field formula tool.

Choose 'all types of' in the menu and check every field including the dybamic/unknown fields option.

Uncheck the option which says rename and add prefix.

Check the option to change the date type and set it to v_string.

Set the formula statement to be [_currentfield_].

Alternatively, you could wrap any values you use in your formula in a tostring() which then means, If the field comes through as a text or double, it will always be treated as a string within that specific formula.

Ben
jdunkerley79
ACE Emeritus
ACE Emeritus

You can use a Multi-Field tool to amend the type of all columns to be string:

2019-01-28_07-40-45.jpg

By default the tool will create NEW_ columns so make sure you untick that.

 

The expression 

ToString([_CurrentField_])

 

Will convert all types to string. 

 

Tiny sample attached

Nidhin
8 - Asteroid

Thanks you both. Didn't knew it was this easy to do.

zach_deloach
5 - Atom

Thank you. This is a huge help and it ties perfectly with using the Auto Tool and Dynamic Select as discussed in this thread: Automatically Remove All Null Columns 

 

Since the Auto Tool only evaluates string fields, it's nice to be able change all fields to string and then have it evaluate them all.

Miglani
7 - Meteor

Isn't the expression/formula redundant here? Can we not just pass [_CurrentField_]?
Because the tick mark(Change output type to V_String) will convert the fields to type V_String.
What is the significance of ToString() here, if my understanding in not correct.

Thanks.

Labels