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, thanks for the knowledge! I did star your idea already!
I am just uploading my solution although better versions are available in this discussion already.
@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.
@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.
Good morning all :)
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?
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.
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.
@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.
@PhilipMannering I have @AdamR 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.
:-) 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?