Is there a "set" type function within Power Automate? Can't seem to find one. A set action exists, but attempting to avoid an action as this will run within a nested apply to each loop within an if condition action, and evaluating a condition action is very slow in Power Automate. Some performance improvements can be found using the expression builder to code the condition within loops instead.
Attempting to work within the limitations of Power Automate given that the if expression must have an else parameter set.
Trying to replicate the following, which is simple in most languages, but extremely difficult in Power Automate:
if condition is true:
then set variable1 to value
In Power Automate, since an "else" param is required, set a dummy variable with a null:
if(equals(variables('variable1'), true), set(variables(variable1), 'value'), set(variables('dummy'), null))
Does a set function exist?
There is no expression in Power Automate that allows you to set the value of a variable. You need to use one of the variable actions such as Set Variable.
So, in your case, you'll want to use a condition and then a Set Variable action. Note that you can use expressions in your condition.
Thanks for the response. That's exactly what I was afraid of. My flow is currently designed to execute in the manner that you describe above, but looping through 400+ array elements, then looping through a secondary nested array with 1-15 elements and evaluating multiple conditions to set a variable is very slow. Doing it the method above causes the processing time to be greater than 2x.
Any chance that you can use a Filter Array action or other filters to limit the number of elements to loop through?
Understood. I don't know if the structure of your Flow will permit it, but if you can use Compose actions rather than variables, you might see some improvement in performance. Also, try going to settings for your loops and setting concurrency to On and stepping up up the degree of parallelism. Note that doing so may wreak havoc on variables used in the loop.
My apologies if you already thought of this....
Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Attend in person or online, there are incredible conferences and events happening all throughout the month of September.