This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Is it possible in Alteryx to define some variables, allocate them value on run time and use them during the course of workflow.
Like I have a situation in which I need to use a calculation (number of records / Sum(some column)) across the workflow and I do not want to write this expression again and again. So is there any way that I could save this calculation in a constant or something and use it across the workflow?
If your values are to be derived from the data that's being passed through, you can summarize (or use whatever tools to get your defined value) and then append it back into your main data set which you can then pass through and use in your downstream tools.
If you are defining variables that are static and not derived from the data, you can add new "Workflow Constants".
In a Formula tool (or any tool that contains an expression builder), under the "Constants" you'll have your value to use where ever needed.
Using constants will not solve the purpose as every time when the input file will change the value of the variable will also change as it would be calculated from the ingested data.
I have a question regarding your 1st approach i.e. using a summarize tool. Would this be an optimized solution, as the same summarized value will get appended to each every record in the ingested data? Also I would like to know that is summarizing based on some conditions is possible or not?
You should not see any significant impact with performance by doing this, but yes; you would be appending that value to every record in your dataset. You don't necessarily need to use a summarize tool, but the part that's important is that the data that you append from the source (S input) only contains ONE RECORD, otherwise end up with a Cartesian product, which would not be suitable based off my understanding of your use case.
The summarize tool is not a tool where a conditional statement can be applied. It's simply aggregating/summarizing your the data you feed into it based on how it's configured. You would need to prepare/filter your data before it hit the Summarize tool.
Well I find this very strange that why Alteryx has not given the summarize function option in the "Formula" tool. I guess that would have been a more optimized approach rather that repeating the values again for the whole record set again and again.
So I would be going with the solution which you have suggested. Thank you for the help.