Page 1 of 1

Use sub-flow as custom Condition

Posted: 13 Feb 2014 16:26
by porten
Hi

I'd love to have a "custom Condition" workflow-type. Implementation suggestions:

Add a new Condition called "Execute Flow as Condition" or someting similar.

When the parent flow invokes this Condition-type, it executes a single specified subflow and waits for it to complete.
At some point during subflow execution, it can invoke a new Action called "Set Condition Result", specifying if it should be True or False. This Action can be called multiple times in the sub-flow - only the last invocation counts. If the "Set Condition Result" Action is never executed by the sub-workflow, the default Condition Result is False.

When the subflow completes, the parent workflow's "Execute Flow as Condition"-Condition evaluates the variable set in the subflow via "Set Condition Result", and performs normal routing/execution from that point on.

This is already possible to do in a 2-step approach using global variables:
1. Execute the subflow via "Execute Flows" Action. The subflow sets a global variable to "true" or "false".
2. Use an Expression Condition to test the contents of the global variable.

The 2-step approach is workable, just cumbersome if you wish to re-use custom Conditions across multiple flows. Having a "real" custom Condition would be gold :).

Cheers,
Morten

Re: Use sub-flow as custom Condition

Posted: 13 Feb 2014 18:23
by Martin
Hi,

You can already do something like this with the current implementation of Execute Flows by using the option Wait for called flows to finish and Return variables to the calling flow without using global variables.
The latter option will take all local variables of the called sub-flow and makes the variables available in the parent-flow.

Flows could look like this:
Parent Flow
-trigger ...
-action Execute Flows: Child Flow (check both options)
-condition Debug Dialog

Child Flow
-trigger empty
-action Script: result = true;

The parent flow synchronously executes Child Flow, waits for the result and shows a dialog with all available variables. This should show variable result with value true.

I see that an integrated action Execute Flow as Condition would be useful and simplifies the above procedure so I add it this to the list of features under consideration.

Regards,
Martin

Re: Use sub-flow as custom Condition

Posted: 13 Apr 2017 01:04
by mstout
Has this feature ever been implemented?

Update: 04/13/2017 09:32 UPT: Never mind. Figured out how to use Conditions:Expressions for this need.

Thank you for a great product. Been blogging about it at markstout.blogspot.com.