Stuck on part 1, don't know why it doesn't work.
For most of the sample code given, it works. Though for code with more than 2 sub_packet split, I will need to manually add more macro. (As my data has only one split, so it should work.)
General idea is to handle string as instructed, use substring to progress in series.
Just took 2 hours to read the prompt. Painful iterative. Wanted to keep track of the hierarchy but those packets that contain X number of packets are a pain...
The hierarchy is all messed up (stored in recordID), so no way I can tackle part 2 as it stands... number_dec 8 RecordID 1.3.2.4.9.2.1.2.2.1.9.5.1.5.2.1.1.3.1.1.1.1.1.1.2.4.2.1.2.1.2.1.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1 version 0 type 4 children
phew, finally got part 2 to work.
Part 1 macro wasn't too complex. Regex was a big help on the getting the literal values. TIL that you need to put a + in front of your string if it's exactly 32 characters:
Part 2 macro was much worse and took some refactoring after it worked on the samples but not my data. Basically I process as many subpackets as possible and then try again.
WOW - that took a day to figure out an approach and to execute. To be fair to the problem, I'm not a speed-developer like @NicoleJohnson . This is another one of these problems that would be much easier to solve in a single pass using recursion, but Alteryx doesn't have this yet.
Fun part of this was that I got to use something I learned a while ago from @patrick_digan - the Dynamic Replace, and it's ability to create code that can be created & executed dynamically.
Then the part that iteratively solves the tree
And finally the piece that executes the calculations
Spent 3 week (everyday 3 hours though)... to complete this.
with this nice tree, I can do part 2 easily.
thank @SeanAdams for the workflow. so that i can realise i very close to the correct answer.
thank @patrick_digan for mention the sign issue in BintoInt conversion, just a steps to the correct answer.
i was thought a ABS function will solve the issue.
I'm with you on this @Pang_Hee_Choy - I'm still crunching my way through the last 3 AOC challenges.