Alteryx Designer Knowledge Base

Definitive answers from Designer experts.
Don't forget to submit your entry for the Excellence Awards by October 30! | Need more information about the program? Check out the blog here

Using the Dynamic Replace Tool

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

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.  

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. 

8 - Asteroid
8 - Asteroid

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

 

Ken

 

5 - Atom

Thank you! The demo workflow is super helpful!!