Check if flow variable exists - Part 2

Hi @Anjo , the function flowVariableExists() takes the name of the variable to check. It takes the name as a string.

So, in your case, you want to check for:
flowVariableExists("v_Row0")

You can refer to the “Individual variable check” part of my workflow for that.

If you want to pass a variable to it, the variable should contain the name of the variable to check.

For example, you can define a variable called variable_to_check and it can hold “v_Row0”.

So, if you have variable_to_check = "v_Row0", you can then pass it to the function:
flowVariableExists(variable_to_check)

You can refer to my “Multiple variable check” part for that. In my loop, I am checking for each of the values that’s coming from that Table Creator, which are “variable_1”, “variable_2”, …, “variable_5”.

You are seeing “variable_5” because it’s at the end of the loop, so that’s the value of the last iteration. But for sure it went through all of them, “variable_1”, and then “variable_2”, etc…, to “variable_5”, and it checked if each of them existed or not.

That is how it produced this result:
image

And you saw from this window that only variable_1, variable_2 and variable_4 existed:
image

So, the results match the reality.

I’m not sure I understand what’s the issue you are facing.

If you were to look at how the loop worked, let’s first understand that this function is always executing flowVariableExists(variable_to_check) within the loop.

On the 1st iteration of the loop, variable_to_check will be assigned “variable_1”, so
flowVariableExists(variable_to_check) will in fact run flowVariableExists("variable_1")

On the 2nd iteration of the loop, variable_to_check will be assigned “variable_2”, so
flowVariableExists(variable_to_check) will in fact run flowVariableExists("variable_2")

etc

And on the 5th iteration of the loop, variable_to_check will be assigned “variable_5”, so
flowVariableExists(variable_to_check) will in fact run flowVariableExists("variable_5") (hence why yuo see “variable_5” at the end of the loop)

3 Likes