Free Trial

Alteryx Designer Desktop Discussions

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

Assigning Null Value records in Iterative Macro

Puru
7 - Meteor

Hi there

Trying to assign Null Category records under named Category records. This looks like Iterative Macro but somehow Multi-row doesn't work.

Set A - each Category should have 5 records. The missing records are in Set B in ascending order. The records from Set B should flow into Set A till each Category in Set A reaches count of 5. So if the Category 1 is missing two records then first 2 records from Set B should flow in Set A under Category 1 and take the name 1 and so on. If the Category in Set A already has 5 records then no addition is required.

 

Set A records   Set B records 
CategoryOrderNameAddressCategoryOrderNameAddress
16ArthurNew YorkNull51LiamFort Worth
18JohnLos AngelesNull57EmmaSan Francisco
110BrandyChicagoNull52NoahCharlotte
212DawnHoustonNull67WilliamColumbus
211TonyPhoenixNull56OliviaIndianapolis
314DanielSan AntonioNull50AvaSeattle
37MarshallPhiladelphiaNull58JamesDenver
39TerySan DiegoNull66IsabellaWashington
317SheriseDallasNull55OliverBoston
415MayaSan JoseNull59SophiaEl Paso
416ElleAustinNull65BenjaminNashville
513LeoneJacksonvilleNull72MiaPortland
619JonMesaNull54LucasLas Vegas
621JonathanKansasNull64AmeliaOklahoma
618DavidMiamiNull68MasonDetroit
622ErinRaleighNull63HarperMemphis
620MikeLong BeachNull71MeganLouisville
    Null53LoganBaltimore
    Null70EvelynMilwaukee
    Null62JulieAlbuquerque
    Null60JodieTucson
    Null73MichaelFresno
    Null69CharlesSacramento
    Null61GeorgeAtlanta
    Null80RobertOakland
1 REPLY 1
ggruccio
ACE Emeritus
ACE Emeritus

Hi @Puru,

 

While you can probably build an iterative macro there is often more than one way to approach a problem.

 

For this one I created a numeric ranking for each of the data rows in Set A using a bit of a workaround (you'll see it's a summed running total based on the value 1).  Knowing each category requires 5 values, I did an append by category to a list of numbers 1-5.  I then created two data streams - one with slots already filled, and one with slots yet to fill. 

 

If set B is already in ascending order then you can just fill in the missing slots by joining based on record position to the Nulls and unioning back to set A.  The rest is cleanup.

 

Please see the attached workflow:

Labels
Top Solution Authors