Alteryx Designer Desktop Discussions

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

Dynamic replace based on if then statements

Sabine_van
6 - Meteoroid

Dear Community,

 

In my dataset I would like to dynamically replace values based on if then statements. I have included some mock data to illustrate what kind of data I have. 

The first dataset is a dataset with several characteristics per car:

Sabine_van_0-1662103746958.png

My second dataset is a set of if then statements that need to be used to update my first dataset:

Sabine_van_1-1662103837705.png

The first line reads as IF [Color]='black' AND [Type]='sedan' THEN [Price]='600' ELSE [Price] ENDIF

As you can see the if then statements address different columns and replacement occurs in different columns as well.

In addition, due to the nature of my real life data (for example misspellings) we need to deal with values as a contain rather than is. 

In the second line the brand reffered to is not Kia, it needs to contain the letter K. 

 

The desired outcome is as follows:

Sabine_van_2-1662103875737.png

 

My thinking was to break the problem down into two parts: 1) selecting rows that are affected by if then statement; 2) dynamic replacement of the values.

The last step I can perform using the dynamic replace tool, but I am struggeling to find a dynamic solution for the selection of the rows affected by the if then statements. My actual data has many more columns and rows that could be affected and the number of if then statements that I need to apply are north of 500. 

Who can help me?

 

10 REPLIES 10
flying008
14 - Magnetar

Hi, @Sabine_van 

 

Could you upload the full rules to show this conflict? Personally I always feel that dynamic-replace can solve this problem. (maybe not need macro.)

Labels