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 #374: Using Iterative Macros

AYXAcademy
Alteryx
Alteryx

 

A solution to last week's challenge can be found here.

 

 

Iterative.pngChallenge #74: Build a Factorial Calculator was published way back in June 2017. It pushed Alteryx designers to make a macro to calculate factorials. A worthy goal, to be sure.

 

It is time to dust off an old classic and ramp up the difficulty a bit.

 

My manager, Sydney, is obsessed with iterative macros and wants to see if I can use them properly. Sydney loves clean workflows, so there may be no other tools on the workflow canvas other than a single input, the macro, and a single output. And finally, my manager is entertained by simple things. Sydney likes the idea of the macro spinning around and around, calculating the factorials one multiplication problem at a time. So, the iterative macro must conduct a single multiplication per input number on each pass.

 

Are you up to this new challenge?

 

Here are the original challenge requirements to refresh your memory on factorial calculations:

 

Factorials are commonly used to calculate the multitude of ways a task can be completedsuch as how many possible results could come from shuffling 52 playing cards.

 

Factorials are usually represented by ‘n!’n being an integer. If we were looking for the factorial of 4, it would be represented as 4!. To calculate the factorial of 4, the equation is written as (4)*(3)*(2)*(1). The following are some example calculations:

 

1! = (1) = 1

2! = (2)*(1) = 2

3! = (3)*(2)*(1) = 6

4! = (4)*(3)*(2)*(1) = 24

 

New Challenge Requirements:

 

  1. You must use an iterative macro.
  2. You must conduct only one multiplication step on each input row, on each iteration.
  3. The workflow must consist only of: Text Input - Macro - Output

 

 

LynnPätzold
8 - Asteroid

I'm still struggeling with macros. I needed to add an empty  "output" column to the input. I didn't figure out how to do it otherwise. I'm looking forward to the other solutions. 

Spoiler
Macro.PNG

 

ahsanaali
11 - Bolide
Spoiler
ahsanaali_0-1685977267965.png

 

ahsanaali_0-1685977482321.png

 


 

binuacs
20 - Arcturus
Spoiler
binuacs_0-1685978161341.png

 

Kenda
16 - Nebula
16 - Nebula
Spoiler
Kenda_0-1685979409506.png



Kenda_1-1685979455264.png

 

WesCannon
Alteryx Alumni (Retired)

That's a fun way to start a Monday!

 

Spoiler
WesCannon_0-1685980261137.png

 

mmontgomery
11 - Bolide

Modified my text input to do what I needed.

Spoiler
mmontgomery_0-1685980795536.pngmmontgomery_1-1685980806927.png

 

 

ejhaley
8 - Asteroid
8 - Asteroid

Fun!! and a great way to start a Monday :D

Spoiler
Got stuck on the "circular reference" of initializing the Factorial field and calling it at the same time in a formula tool... finally clicked that I could initialize it in a Text Input in the macro :P

ejhaley_0-1685981763722.pngejhaley_1-1685981782557.png

 

  

nSpire
9 - Comet
Spoiler
nSpire_0-1685982423160.pngnSpire_1-1685982483116.png

 

ggruccio
ACE Emeritus
ACE Emeritus

Here's mine - I did add a field to the text Input so I could keep accumulating the total between iterations while still keeping the label of the original number.

 

Spoiler
ggruccio_0-1685982917121.png