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 Knowledge Base

Definitive answers from Designer Desktop experts.

Using the Dynamic Replace Tool

ChadM
Alteryx Alumni (Retired)
Created

The Dynamic Replace Tool allows the user to quickly replace data values on a series of fields, based on a condition or expression. The data replacement can be based on formulas or static values. This means that if you have values across multiple fields that need to be replaced or updated, you can use the Dynamic Replace Tool to create a series of formulas for each value, then update those values.  You may be asking why you would use this over something like the Multi-Field Formula tool.  The answer is simple...flexibility.  If you were to create a module using the Dynamic Replace Tool, and had an update to your data that provided more values than you previously had, you can simply update your Replacement Values file to account for the new values rather than going in and updating your module. 

In the attached example, you will see we have a basic incoming data file.  This needs to be updated, but we would like our update to be more dynamic than using a Multi-Field Formula.  We create an Input File with each of our expressions, then compare those to our data.  Once the comparison finishes, the tool will output your updated data, as well as a Summary table that informs you of the changes that took place within your data.  

Check out the attached example, and don't hesitate to ask any questions.  Thanks, and until next time!

 

Note: Also be sure to check out Tool Mastery | Dynamic Replace.

Chad
Follow me on Twitter! @AlteryxChad 

Attachments
Comments
Janbrooijmans
5 - Atom

Hi Chad,

I tried using your example. Want to replace a number into a string. So the other way around. 

E.g. I have different sales_types, which are named 0, 1, 2, 3, etc. I want to replace them by 0 = Pre order, 1 = Order, 2 = ... etc. 

 

But I get these errors...?

Error: Dynamic Replace (5): Parse Error at char(0): Invalid type in operator ==.
Error: Dynamic Replace (5): RecordInfo::CreateRecord: A record was created with no fields.

 

Can you help me out?

 

Thanks,

Jan 

ChadM
Alteryx Alumni (Retired)

Hi Jan! Try adding quotes around your new descriptions, so 0 = "Pre order", 1 = "Order", etc.  Generally, an "Invalid type" error is due to this.  

Janbrooijmans
5 - Atom

Thanks Chad! Had to loose the quotes around my numbers in the expression; so 1 instead of "1"...

 

It now works even without the quotes around the new description. 

Ken_Black
9 - Comet
9 - Comet

This example needs to be put into the 1-tool example set. 

 

Ken

 

jiujiujoe
5 - Atom

Thank you! The demo workflow is super helpful!!