Alteryx Designer Desktop Discussions

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

Find and Replace Macro

Carluccio555
9 - Comet

Muddling my way through a find and replace macro and needs some help to get over the line.

 

I've set up the macro as follows, the fields im trying to cycle through and the replacements are shown in the excel input further below.  I need to feed the fields through the control parameter, I've set up the macro template and the action type as update value with the text 'Region' as the string to replace with the other fields, the replaced string adds F or R for the find or replace fields.  The Macro input tool is the data I am cleansing.  If I have a list of all field strings to replace 'Region' in the template, how do I feed that to the control parameter so it works?

 

image.png

 

The MasterDataCleanse.xlsx is as below:

 

image.png

4 REPLIES 4
Carluccio555
9 - Comet

OK I created a table for the control parameter to loop through to replace the string which changes which field is being iterated in the find and replace.

 

The issue I have now is an error saying the the Data input into the macro (the data with multiple fields that are being cleansed via Find and Replace) isn't fully mapped?

 

If I look on the questions tab of the macro tool I see this:

 

 

image.png

There are no fields to choose from as they are all 'taken'. I'm confused why this is even necessary as the Close Date and Amount fields aren't being cleansed by the macro? They are just part of the input data.

 

danilang
19 - Altair
19 - Altair

Hi @Carluccio555 

 

Inside your macro Input tool, remove all the columns that are not necessary for the macro to work.  Ideally this would leave only the field that you're replacing.  That will leave only the mapping question for the field that the macro will act on.  Any extra fields that are used in the main workflow will just be passed through the macro.  

 

Dan

Carluccio555
9 - Comet

The field Im replacing will change based on the control parameter, the input is now trimed to be just the 7 fields that would potentially have replacements, just field headings no data (not sure if this is necessary). Looks like this:

image.png

 

This is what is fed to the control parameter:

 

 

image.png

 

The action tool in the macro is setup like this on the find and replace:

image.png

image.png

 

Carluccio555
9 - Comet

The macro is outputting without an alteryx error but the find and replace isn't working in the main workflow (but works in the macro template) and also my output rows are 7 times the input rows so its multiplying the rows by the control parameter. No idea how to make this work.

Labels