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 new rows conditionally based on strings in other rows

AkisM
10 - Fireball

Hi, I am working on an alteryx workflow and I'm trying to achieve a certain behavior that I have trouble getting to with my currently beginner knowledge. The workflow first imports an excel table which looks a bit like this:

 

             Name    Age    Height  Married

Row 1   Anna     18       1.56       Yes

Row 2   Dave     23       1.78       No

Row 3   Don       21       1.66       Yes

Row 4   Mary     25        163        Yes

 

I need an expression/formula (I don't know which tool would be best for this) that will search the column "Name", and every time the name "Dave" occurs, a specified number of new rows will be added below it with the same values, except the married status changes to the opposite value of the original row.

 

What's the best way to achieve this?

7 REPLIES 7
andyuttley
11 - Bolide
11 - Bolide

Hi @AkisM 

 

Interesting use case! I'd probably do it this way (also attached). You can go into the generate rows to select how many rows of Dave to add underneath (here I've added 2 additional lines)

DaveRows.PNG

 

 

Hope that helps. And that Dave's ok. 

Andy

jamielaird
14 - Magnetar

Interesting use case..

 

The attached should do the trick. I've included an input where you can define the number of rows-per-Dave in addition to the main data input.

 

Have a play around and you should be able to tweak this to meet your requirements.

 

Screenshot 2019-07-04 at 10.59.21.pngScreenshot 2019-07-04 at 10.55.06.png

jamielaird
14 - Magnetar

@andyuttley we're tripping over each other today 🙂

jamielaird
14 - Magnetar

By which I mean, you're beating me to most solutions 😉

RishiK
Alteryx
Alteryx

Both of you beat me to it! I like both solutions

jamielaird
14 - Magnetar

To be fair I did waste about 10 minutes trying to pick the best 'Dave' image for my macro.

andyuttley
11 - Bolide
11 - Bolide

10 minutes well spent @jamielaird  - big fan of the macro image

 

Trying to think why Dave's status changes so much; maybe he's had one too many rows LOLLL

Labels