I am a relative newbie to Alteryx,but could not find an answer to below without the use of constants
IF a THEN [example] = 10 * [example]
ELSEIF b THEN [example] = 20 * [example]
ELSE [example] = 30 * [example]
ENDIF
How can I input the parameters (10, 20 and 30 in the example above), without
a) using constants (therefore I have too many parameters in my model, unless I could input/ import constants from an external excel source...
b) creating 3 extra columns all filled with the same number 10, 20 and 30
Thanks.
Solved! Go to Solution.
The Interface tools are definitely a go-to when you need to pass in user-defined (parameter) values. As a result, you'll have to turn this into an app or macro, but here's a quick example:
You set up the workflow as normal, with just some dummy values, as these will be replaced by the user selection anyway. Here I've just used 10 like in your example -
Then you set up your Action tool to update only this part of the expression (in this case the 10) -
Now when I run this, it'll replace the 10 with whatever number I provide and show the outcome -
I just used a numeric up/down as it seems the most suitable for your use, but in reality there's a bunch of tools under the 'Interface' palette. In your case you'd just need to do this 3 times - one for each value in your if statement.
Hope this helps - have attached my workflow for reference.
Thank you DataNath,
See how this could work, but not sure I want (as only user) to input ca 15 parameters every time I run this. Have now an excel with different parameters for different countries.
@jvanderpol so you have values in a main table and if they match values from a second table you want to use the multiplier associated with that? If so, you can do this fairly easily with a mapping table and the find & replace function. If you can provide some dummy data/a workflow you have in progress that'd be great.
No problem @jvanderpol! So here, I basically made a little look-up table with the types and what multiplier you want to apply to each (just used random values, obviously change these to fit your use):
In the Find & Replace, we can then use this tool to look for a match in Types in your main dataset. Where it finds a match, it then appends the relevant multiplier:
Then, in your formula tool, you can simply reference the multiplier field, rather than having to type out the values yourself - again, I just added this to your current formula to demonstrate but you'll need to change this as needed for your use:
Workbook attached, let me know if there's any issues!
Thanks, works indeed. Would have hoped for a solution without the step of adding an additional column, but does the job nicely.
Appreciate your help in this #neverstoplearning
User | Count |
---|---|
18 | |
14 | |
13 | |
9 | |
8 |