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

Add or remove rows based on a condition

Santhoshraj
6 - Meteoroid

I have a table like 

 

NameID
Johnjn12
jimjm13
jackjk14

 

I want to add two new rows only if the ID column contains "jk14". 

The two new rows would be something like 

NameID
jackson 
jackie 

 

Final output if ID column contains "jk14" should be: 

NameID
Johnjn12
jimjm13
jackjk14
jackson 
jackie 

 

Final output if ID column Doesnt contain "jk14" should be:

NameID
Johnjn12
jimjm13
4 REPLIES 4
Christina_H
14 - Magnetar

I've used a random sample tool to randomly take two of your input rows.  If jk14 is included, the extra two rows will be added.

Capture.PNG

JamesCharnley
13 - Pulsar

Hi @Santhoshraj 

 

If you're using 2023.1 then a workflow with a contains check and control containers should work nicely (I'm kind of just playing around with control containers where possible at the moment). The workflow is sort of a mess but looks like this:

 

image.png

 

It's using a summarize tool to concatenate IDs to check the presence of jk14 in any row in a filter. If there is an instance of jk14, the above control container is activated, adding the extra rows on. If there is no instance of jk14, the below control container is activated, but the two streams can be joined together. Without the control containers, the extra rows would still be unioned after the first control container so different logic would be needed.

Santhoshraj
6 - Meteoroid

@Christina_H Great. Thanks a lot. It worked for me. 

Santhoshraj
6 - Meteoroid

@JamesCharnley Unfortunately I am using an older version of alteryx and couldnt try out your solution. Thanks for the help.

Labels