Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #66: My Wine Problem

JoeM
Alteryx Alumni (Retired)

Last week's challenge is posted HERE!

 

OK, I have a problem... for you to solve!

 

We are selling bottles of wine - each of which has a unique ID since it's a limited vintage.

Customers can request their wine bottles be delivered in various different sizes of delivery box.

Customers order wine in ranges - from ID 1 to 25 for example.

 

Challenge: Build a macro that takes in order ranges, allows the user to input the box size, and outputs the order broken into the requested box sizes.

 

There are 3 sample outputs displayed to test the different box sizes:
- Box size of 6
- Box size of 12
- Box size of 96

The macro must check for, or prevent 3 specific error conditions:
- a null value for either the from or to value on an order range
- non-numeric values in the from & to values
- situations where the from ID is greater than the to ID

 

BONUS - Instead of using an interface tool to allow the user to set 6/12/96 box sizes, build a batch macro that will package all three scenarios at once!
DOUBLE BONUS - Complete this challenge whilst listening to some UB40

alex
11 - Bolide

The solution output for #3 has box size of 96 not 120?  triple bonus to do both :>

JoeM
Alteryx Alumni (Retired)

Thanks for pointing that out @alex! I updated the exercise and the post to reflect 96. However, the beauty of this macro could be that you could test all packaging conditions :) Triple bonus?! I'm feeling generous - why not?

Philip
12 - Quasar

My solution. I use the same macro to output all three scenarios.

 

Spoiler
WineBottleGroupings.png
Natasha
9 - Comet

Definitely no bonuses for me as it took me ages and I appended all 4 box sizes instead of using a batch macro.

 

 

Spoiler
Screen Shot 2017-04-17 at 20.56.57.png

 

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

@JoeM,

 

I created a standard macro that calculates all 3 options at once.  No batch required.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
BenMoss
ACE Emeritus
ACE Emeritus

I'm not shooting for bonus points this time round ;)

 

Spoiler
2017-04-18_00-27-06.png

I believe I have catered for 2 of the three error conditions but I am a bit confused as to what is expected in the case of 'non-numeric values in the from & to values', but you can take a look at my macro too see how I have dealt with this.

 

NicoleJohnson
ACE Emeritus
ACE Emeritus

My solution! And my kind of problem!! :) (Admission: I finished this one with a glass of red, red wine right next to me. Cheers!)

 

Spoiler
Tested for 6/12/96/120 bottles of wine, just for kicks. Although let's be honest, 120 bottles is probably the only one that's necessary... :)

Figuring out the macro portions was the hardest part for me since i haven't had much exposure so far. Originally I tried to have a dynamic selection of box size as well, but I need to do a little more macro-playing before I go that route it appears, so we're sticking with basic inputs for this one. Included the app file I used to test my theories. 

I might revisit this one though. I'm not convinced my conditions are working 100%. And I am convinced the box selection could be dynamic. 
WeeklyChallenge66.JPG

App for testing the macro with new values.
WeeklyChallenge66MacroTest_NicoleJohnson.JPG
MinaGO
7 - Meteor

Nice challenge! Wasnt as bad as I originally thought it would be but I definitely use too many tools. Personally I liked the idea of three separate outputs so I added a standard macro outside my batch to give S, M, L outputs. Cant upload packaged workflows for whatever reason so only screen shots this time :).

 

Spoiler
Screenshot (320).pngScreenshot (319).png

 

JoeM
Alteryx Alumni (Retired)

Wow @NicoleJohnson! Now there has to be some sort of bonus for that! ;)