Skip to main content

Dynamic Replace tool Dynamic Replace Tool

One Tool Example

Dynamic Replace has a One Tool Example. Visit Sample Workflows to learn how to access this and many other examples directly in Alteryx Designer.

Use Dynamic Replace to quickly replace data values on a series of fields, based on a condition. The data replacement can be based on formulas or static values.

Say you have a hundred different incoming fields and instead of the actual value in each field, you want to represent the number with a code of A, B, C, D, etc. that represents a range. The Dynamic Replace tool can easily perform this task.

Inputs

  • D anchor: The Data stream to modify.

  • R anchor: The Replacement data stream, which contains 3 columns used to configure the tool.

Configure the Tool

  • Field Name Field: Select a column from the R data stream that contains field names from the D data stream.

  • Boolean Expression Field: Select a column from the R data stream that contains an expression that is used to evaluate the data from the D data stream. The Boolean Expression field can accept any value other than zero.

    • Expressions are evaluated in sequence and stop at the first match. Therefore, an expression does not need to check for both ends of a range but does need to be in ascending order if evaluating a series of ranges.

    • Use _CurrentField_ to refer to the Field Name Field that is currently being processed if an expression is used for more than one column.

  • Output Value Field: Select a column from the R data stream that contains replacement data. The column can contain static values or expressions that act on the data from the D data stream.

  • Values are Expressions/Formulas: Select if the column selected for Output Value Field contains expressions to have the expression act on the data from the D data stream.

Field Type Handling

Because this tool replaces column values, you might need to update the column's data type.

  • Autofield Field Types: Alteryx Designer sets the data type to accommodate all contained data.

  • Keep Original Field Types: The original field type is maintained. If the field type is incompatible for the replacement data, an error or conversion error occurs.

  • Change Field Types to: Manually set the field type and size. If the field type is incompatible for the replacement data, an error or conversion error occurs.

    • Type: Use the dropdown to pick the desired field type.

    • Size: Enter the numeric value for the field size. The size parameter is ignored if the data type does not require a size, such as a spatial object.

  • Warn/Error on Unmatched Data Fields: Select the intended behavior for unmatched data. Choices include...

    • Allow unmatched data fields: Unmatched data fields are replaced with [Null] values. No message is reported in the Results window.

    • Warn on unmatched data fields: Unmatched data fields are replaced with [Null] values. A Warning message is reported in the Results window for each unmatched field.

    • Error on unmatched data fields: An error is thrown for the first unmatched data field and the workflow run stops.

Outputs

  • O anchor: The Output data stream that contains replacement data.

  • S anchor: The Summary of replacements, including counts of each replaced field name and output value combinations.