We are one week away from the challenge #75 milestone. Some users want to race this one to be the first to 75 and nab the first ever ‘Burgschrund Crevasse’ badge. I will plan to post the challenge on 6/26/2017 at 9:00 AM PST. The main contenders are @SeanAdams, @NicoleJohnson, @LordNeilLord, and @EstherB47 barring any other users catching up on a significant amount of challenges this week.
This week, we are going to slow it down and take a breather after our two-week long challenge #73 and shoot for something simpler. This week, the goal is to create a macro that calculates factorials. To find the exact formula, you can find it here: https://en.wikipedia.org/wiki/Factorial. Factorials are commonly used to calculate the multitude of ways a task can be completed – like 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). Below are some example caculations.
1! = (1) = 1
2! = (2)*(1) = 2
3! = (3)*(2)*(1) = 6
4! = (4)*(3)*(2)*(1) = 24
Now I'm off to do some pre-race stretching for next week. And polish my out-of-office email so no one bothers me starting at 9am PST on Monday. :)
My solution below
I find it particularly difficult to keep all the input fields, keep the same input names and keep the same field order without a shed load of action tools. Any advice on this?
@PhilipMannering In regards to your action tools, I would make a couple tweaks to avoid this:
1) I would check the box on your macro input about show field map. This is a powerful option where whatever the field name that comes in from the workflow, it converts it to whatever field name is in the macro input. For this case, it would convert the fieldname "Number" to "vals".
2) I would add a select tool at the end, and then connect an action tool from the macro input to your select tool using the "update select with reverse field map" option. This is the way to change vals back to Number so that the user never knows that the fieldname was changed.
3) I would change your join tool so that your field is named vals instead of right_vals. For #2 to work, it has to find the field vals exactly to convert it back.
Now you can delete all the action tools and your interface as well:
Hope that helps!
Nice one! I rarely use the Generate rows tool but it was very helpful in this case. :)