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

Alteryx Designer Desktop Discussions

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

Insert missing rows based on pattern and then group enties

hellyars
13 - Pulsar

This is a two part question.   Sample data attached.

 

Each entry is currently trapped vertically. 

Each entry should have 5 fields associated with it: 1) Name, 2) Hull, 3) Date, 4) URL_PART, and 5) Status.

Typically (not depicted in this data) each hull has 1 entry (consisting of the 5 rows referenced above).

These are the problem entries.

There are two major problems: 

1) A given Hull (e.g. AFDB 1) has 3 entries (3 sets of 5 records, this unique feature being Date and Status)

2) Some entries (e.g. AFDB 7) has >5 rows associated with it (AFDB 7 is missing Date and Status).

 

Questions:

1) How can identify if an entry does not have 5 rows associated with it (using FIELD_NMBR) and insert blank rows to the corresponding missing Field Nmbr/Field?

2) How can I assign each group of 5 records a number 1-N?

 

 

 

 

 

grouping_question.png

5 REPLIES 5
atcodedog05
22 - Nova
22 - Nova

Hi @hellyars 

 

Can you provide expected output for reference.

AngelosPachis
16 - Nebula

Hi @hellyars ,

 

I used a batch macro to generate all missing rows and a multi-row formula tool to assign each group of 5 records a number per hull

 

AngelosPachis_0-1621090953408.png

 

You can notice how some rows are empty, because those were generated in the batch macro.

 

Hope that helps, let me know if that worked for you.

 

Cheers,

 

Angelos

hellyars
13 - Pulsar

@atcodedog05 

 

Hull (Group)HullField Nmbr 
1AFDB 11ARTISAN
1AFDB 12AFDB 1
1AFDB 1306/01/1978
1AFDB 14

URL

1AFDB 15Disposed of
2AFDB 11

ARTISAN

2AFDB 12AFDB 1
2AFDB 1306/15/1974
2AFDB 14URL
2AFDB 15Disposed of
3NCC 17011ENTERPRISE
3NCC 17012NCC 1701
3NCC 1701311/5/2345
3NCC 17014URL
3NCC 17015Commission

 

 

atcodedog05
22 - Nova
22 - Nova

Hi @hellyars 

 

Here is a logic on how you can get the expected output

 

Workflow:

atcodedog05_0-1621093034422.png

 

1. In the Mutlirow formula tool I am starting a new Hull (Group) ID for every occurrence of Name in column field.

2. Using summarize tool group by Hull (Group) you to get only unique instance of Hull (Group) IDs

3. Using a mapping table with needed fields i am creating combination of 5 fields for each Hull (Group) IDs using append tool

4. Using join tool & union tool i am doing a left join so that all fields which exist and doesnt exist previously gets added up. This can also handle even if for a Hull (Group) ID field is repeated.

5. Using formula tool and same formula as yours to assign FIELD_NMBR

6. Sorting row by Hull (Group) ID & FIELD_NMBR ascending.

 

Hope this helps 🙂

hellyars
13 - Pulsar

@AngelosPachis @atcodedog05 Thank you both. 

 

@atcodedog05  Your solution is elegant, simple, and easy to follow.  It is definitely an approach I must commit to my toolbox.  I run into this problem a lot (especially when using Alteryx to scrape and parse 1990s vintage HTML sources)  Thanks! 

Labels
Top Solution Authors