Alteryx Designer

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

Create additional columns on condition

Highlighted
7 - Meteor

I have an input file and will do some modifications to the data through some alteryx tools, after certain point the number of columns could be 20 or less than 20. If the number of columns are less than 20, I would like to manually add columns and null values in it. If there are 20 columns I can skip this step and continue with my process. How can I do that. Any help is appreciated. Thank you in advance!

Highlighted
7 - Meteor

Hello @ssphv, You can drop a field info tool and do a count and go from there

Highlighted
Alteryx
Alteryx

Hi @ssphv.

 

this may not be necessary, but you can also generate the remaining column automatically. I created a sample workflow to show you the concept. I used a batch macro that takes as a control parameter input the number of fields into your original data set and, if it's less than 20, it generates the remaining fields containing null values.

 

clipboard_image_0.png

 

The macro will not append any field if the original data set contained more than 20 fields:

 

clipboard_image_1.png

Hope this helps!

Giuseppe

Highlighted
7 - Meteor

For some reason I couldn't open this macro 

Highlighted
14 - Magnetar
14 - Magnetar

@ssphv 

Perhaps it was created in a more recent version of Alteryx than you have.

 

To fix that, change the yxzp extension to zip. Open with WinZip, and find the macro in the folders. Open the macro with Notepad, and look for the version number of Alteryx. It's in the second row or so. Change to the version of Alteryx that you have and save and close the file. Do this with all macros and workflows in the Zip. Save and close the zip.

Change the extension back to yxzp, and it should open in your Alteryx.

 

Let me know if that helps.

 

Cheers!

Esther

Labels