Hi,
I am new to Alteryx and unless I am mistaken, it appears that it is not as easy to find or think of some solutions that are simple in programming languages.
For example, how would one write an id variable e.g. "test-001" as a prefix to multiple fields created at various stages along a processing flow, without setting it manually multiple times? I want a user to only have to set it once and set it as a new field prefix, where applicable, instead of setting it manually multiple times.
Ed
Solved! Go to Solution.
Sounds like you might want to look into an Analytic App. These prompt the user for data and the input can be used throughout the workflow. The attached is an example where the user enters a pre-fix and it updates a couple of the field names from two different parts of the workflow.
Make sure when running this that you run it as an Analytic App --- the wand next to the green go button:
Hope this helps!
It sounds like you need a User Constant. Once you create your constant you can insert it into the workflow as %User.ConstantName%.
Thank you for your responses.
What if I want to select a field that is my user constant? Do I use the Dynamic select tool?
I have tried the following in the dynamic select tool:
Contains([Name], %User.testName1%)
but this does not work
Any advice?
When using a constant in a formula, you can actually treat it as a field. So, Contains([Name], [User.testName1]). You can see it under the Constants section in the Variables.
Thank you again for responding so promptly.
I tried your advice too and it works. I think it was hashing before when i ticked the '#' so it returned the error.
"Formula: tried to apply string operator to numeric value (Contains)"
There is still a problem with this though. If I have dynamically selected a field, how do I ensure that a tool such as 'unique' automatically selects this user constant defined field?
Any advice?
I.e. if I change the user constant, the 'unique' tool doesnt select the field automatically, even if i have toggled 'ALL' prior to running the flow.
The Unique tool is difficult because it doesn't have the "Dynamic or Unknown Fields" option. Probably the best solution would be to rename the field to something that will be consistent throughout the workflow (so you can select it on all those types of tools), then rename it back to your variable name at the end of the workflow.
OK, thank you once again.
But if I have a prefix and I want to write an expression on a field with a prefix, how do I go about this? e.g.
[%User.testPrefix1% + "some_subtest"] == 0
I think that would be the same situation as the Unique tool. Using the Dynamic Rename Tool, you can switch the name of the field to something "standard", do the analysis, then switch it back to the name with the prefix.