Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2022 Day 7 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team
Discussion thread for day 7 of the Advent of Code - https://adventofcode.com/2022/day/7
31 REPLIES 31
clmc9601
13 - Pulsar
13 - Pulsar

There's a tricky and crucial difference between the example data and the real data! 

 

Spoiler
I'm learning lots of new uses for Generate Rows this AoC!
Screen Shot 2022-12-06 at 11.11.15 PM.png

 

Jean-Balteryx
16 - Nebula
16 - Nebula

Day 7 done ! 

 

And the pain is starting !

 

Workflow and macro :

 

Spoiler
Capture d’écran 2022-12-07 à 07.29.04.png
Spoiler
Capture d’écran 2022-12-07 à 07.29.24.png
AkimasaKajitani
17 - Castor
17 - Castor

Tough challenge! I struggled to create the logic.

 

Spoiler
Sorry this solution is wrong when I cleaned the workflow to post the community.
AkimasaKajitani_0-1670398838770.png
This is the correct solutioin.
AkimasaKajitani_0-1670423104147.png

 



AkimasaKajitani_1-1670398865663.png

 


 

PangHC
12 - Quasar
Spoiler
build and update location based on command.
filter out file and folder.

Pang_Hee_Choy_0-1670400906224.png

macro
use folder link as parameter to filter file path (by if contains). *use folder link macro as unique count of file and folder different
sum file size, add folder path and output.
Pang_Hee_Choy_1-1670401107206.png

 

 

Jotigautam
10 - Fireball

Tricky! So many different scenarios to keep in mind. Got first wrong earlier because I didn't think same directory names in different paths.

Spoiler
Jotigautam_0-1670405605060.png

 

cgoodman3
14 - Magnetar
14 - Magnetar

Definitely one to work through while not sleepy and a day where having the example input made checking the logic much easier

 

Spoiler
Workflow:
I created a list of which directory you were in at any one time. Using regex to strip off the last part of the directory path when moving back up the tree.
cgoodman3_0-1670405733656.png


And created a batch macro to add up the nested directories.

cgoodman3_1-1670405832641.png

 



 

Chris
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
kelsey_kincaid
12 - Quasar
12 - Quasar

I had the example data working in 10 minutes, but like @clmc9601 mentioned there are some key differences to be aware of.

Can't wait to take a look at other solutions when I have some sleep under my belt!

 

Spoiler
kelsey_kincaid_0-1670406925629.png

 

DawnDuong
13 - Pulsar
13 - Pulsar

After getting it easy for D6, D7 picks up again. 

I have opted for flexibility and readability in building my solution, and inserted sort tools before Multi-row, as a best practice although they may not be strictly needed, so that I can flip between using/not using grouping in Multi-row. The downside is that a lot more tools are probably needed.

 

Spoiler

1) Step 1: Instead of getting the full path for every line, I opted to filter out the command lines to get the active directory at each command. Lesser lines = easier for me to read and debug the logic.

DawnDuong_0-1670412941590.png

 

2) Step 2: Recombine the generate the full path for all files and sub-folders.

DawnDuong_1-1670412985587.png

3) Generate (i) direct size and (ii) level for each file and sub-folder

DawnDuong_2-1670413016174.png

 

4) Actual solving for Part 1 and Part 2

DawnDuong_3-1670413043739.png

 

Iterative macro to calculate size of the sub-folders.

DawnDuong_4-1670413101603.png

 

It's a tough one for me. Will have to figure out how the others managed to solve so parsimoniously!😎

atcodedog05
22 - Nova
22 - Nova

My take for Day-7. I have the story first workflow worked with sample data but was failing with the actual data 😅🤣

 

 

Spoiler
atcodedog05_0-1670415213355.png

 

Happy Analyzing :)
Cheers and have a nice day!

 

Labels
Top Solution Authors