Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

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 #74: Build a Factorial Calculator

JSaumya
6 - Meteoroid

I have used a generate rows tool followed by the multi row tool and summarize tool. I was working on how several row values can be multiplied and came across this discussion thread: https://community.alteryx.com/t5/Data-Preparation-Blending/Multiplying-lists-of-numbers-together/td-...

 

 

Though I did keep using the multi row tool, I didn't get the right configuration to generate the factorial until I found the above link.

@ patrick_digan, 

PhilipMannering
16 - Nebula
16 - Nebula

@patrick_digan Thanks for the reply Patrick. And I think if you use the sample tool you can avoid having to reroute your other fields and then use a join tool.

 

My only minor criticism of the map field value and reverse field map the names method is a) it's harder to get the output dynamically named as 'input name ' + 'factorial'. So that when you input your field 'field_m' (for example) the output will be 'field_m factorial'. Thereby helping to differentiate from other factorial fields if you plan on using the tool more than once in the same workflow. The second downside is that you can't change the configuration text for your macro. It will always read something like: "Choose input_vals (Byte) Field" and you can't manually change this to something much nicer like "Choose field to get factorial", as far as I'm aware. This is very minor but something that irks me ... often enough to add all those action tools. 

patrick_digan
17 - Castor
17 - Castor

@PhilipMannering Your points are well taken. I've re attached another attempt. In lieu of using the field map and revers map, I've busted out my favorite technique of using the %Question.<<name>>% method to pass data from the interface tools to the macro. I've added a formula tool to ensure that the vals field is equal to whatever field you choose (like "Number"). Then you can either tweak your summarize tool or add a select tool at the end to fix the names of everything. The %Question.<<name>>% may feel quirky at first, but I've come to love it.

MarqueeCrew
20 - Arcturus
20 - Arcturus

Good morning all :)

 

I've updated my avatar as well as completed my challenge 74.  I am not in the running for the #75 milestone and will cheer the team of @SeanAdams@NicoleJohnson@LordNeilLord & @estherb47 on.

 

In my solution I have addressed the factorial challenge as well as addressed a common macro issue that occurs when you map to incoming data.  I will point to @NicoleJohnson who provided a solution that allows a user to map their source data field to a macro variable named NUMBER.  In the output to her macro she has renamed the incoming field to NUMBER.  If the incoming field name was number, then all is well.  But what if the incoming variable wasn't named number?  Will the user be happy?

 

Another solution by @patrick_digan (a 2017 ACE) adds an interface action tool that is set to re-map the macro variable (Number) back to the original field name (when commenting on @Philip's post.

 

Spoiler
Capture.png

I am glad to solve the challenge so closely to the way that Nicole has solved it.  I don't know if there is a string theory that I missed, but I used doubles and didn't seem to have an issue.  We handled null values differently but in the end we approximate the same answer.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
amarrero45
6 - Meteoroid

Hello Everyone,

 

I am quite excited for this weekly challenge because of it a list of first for me.   It is my first weekly challenge, the firest time I use the generate rows and multi-row formula.

 

 

Spoiler
alteryx weekly challenge #74.png
PhilipMannering
16 - Nebula
16 - Nebula

@patrick_digan Ah, now we're talking. That's brilliant. I've never seen this %Question.Name% before. And I'm struggling to figure out how it works. But I'll have a play! Thanks, Patrick.

patrick_digan
17 - Castor
17 - Castor

@PhilipMannering I have @AdamR_AYX to thank! He pointed out this undocumented feature back when I started making apps: https://community.alteryx.com/t5/Publishing-Gallery/User-Constants-changed-from-intercface-tools/m-p.... I'm just glad to keep passing it along.

Hi All,

 

My first challenge! Please find my solution below.

vishalgupta
7 - Meteor

Solution

SeanAdams
17 - Castor
17 - Castor

:-) We should declare this "National weekend before Challenge 75"!

My solution is attached below - chose to use an iterative macro (like @MinaGO) - not as pretty or elegant as the row generator solutions that folk have provided, but I've been doing a lot of iterative work at the moment, so I figured why not?

 

download.jpg

 

Spoiler

Here's the iterative macro.  Very simple - just take each row, check if the multiplier is now <=1; if yes then output; if no, then perform the multiplication; and decrement the multiplier
2017-06-25_8-11-34.png


Because the iterative macro needs to have the same input for each iteration - it would have had to have 2 input channels and 2 output channels.   I put a wrapper around this to make it cleaner from the main flow.
2017-06-25_8-09-11.png

Finally - here's the main flow with results
2017-06-25_8-11-52.png