Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Dynamic Replace Tool | Apply Dynamic Replace Tool on Multiple Column

luqmantmf
7 - Meteor

Hi Community,

I need help on below situation.

 

Data Input:

luqmantmf_0-1681876344951.png

 

Expected Result:

luqmantmf_1-1681876404695.png

 

I can use Dynamic Replace Tool if there is only 1 column that contain formula, for example formula for TOTAL column only or formula for TAX column only.

Please advise how to provide solution for the problem above, because number of columns that contain formula, can be changed dynamically by user.

 

Thank you very much.

7 REPLIES 7
Yoshiro_Fujimori
15 - Aurora

Hi @luqmantmf ,

This may not be a solution for you, but I would share what I tried.

 

Dynamic Replace tool has two Input anchors, D for Data and R for Replacement.

The formulas to replace should be input from R anchor and original data should be input from D anchor.

 

You can specify multiple fields in Replacement data set, but Dynamic Replace tool seems to calculate based on the initial value from D anchor.

So if you want to calculate TAX after TOTAL is calculated, you would need to do it separately as below workflow.

 

However, if the number of columns that contain formula can be changed, I do not know how to deal with it.

If the formula is set by user outside of Alteryx (say Excel), it may be easier to process it before input to Alteryx.

 

Workflow

Yoshiro_Fujimori_0-1681891160009.png

Input to D anchor

Yoshiro_Fujimori_2-1681891644252.png

 

Input to R anchor (1st tool)

Yoshiro_Fujimori_3-1681891677228.png

 

Input to R anchor (2nd tool)

Yoshiro_Fujimori_4-1681891698415.png

 

Output

Yoshiro_Fujimori_1-1681891619990.png

 

luqmantmf
7 - Meteor

Thank you @Yoshiro_Fujimori 

The problem is, the user only submit the formula, while the calculation is process by Alteryx. 

Yoshiro_Fujimori
15 - Aurora

@luqmantmf ,

 

If the user gives you the formula and the column to apply in a table, 

if the formulas applied to all the rows,

you may be able to make it to a Batch Macro. (never tried, just an idea)

 

luqmantmf
7 - Meteor

Ok,

I'll try.

Thanks again @Yoshiro_Fujimori . 👍

PhilipMannering
16 - Nebula
16 - Nebula

Hey @luqmantmf 

 

I've tried putting this in an iterative macro so that it only executes formulas that it can in each iteration (i.e. no dependents). Needs testing, but seems to work for your sample data. See attached.

PhilipMannering_0-1681904816296.png

 

luqmantmf
7 - Meteor

Hi @PhilipMannering,

I've try using different data as below

luqmantmf_0-1682479289730.png

and, the workflow that you've build, can calculate TOTAL, TAX, TAX 2, and TOTAL 2 column.

luqmantmf_1-1682479370817.png

 

Thank you very much. 👍

PhilipMannering
16 - Nebula
16 - Nebula

Nice! Thanks for showing - pretty pleased with that.

Labels