I don't like to make 2 action to call flow and pass param. So here is workaround how to pass param to called flow with just single command:
Create action:
Execute flow
as Flow Pattern List put:
{a='value1'; b='value2'; f='FlowA'}
This will call flow named FlowA, inside that flow you can read local variables a and b with values 'value1' and 'value2'
Of course you can use just var a or more variables.
Calling flow with param(s)
Moderator: Martin
Re: Calling flow with param(s)
Not sure if my reply is what you mean, but you can pass and read variables to and from the called flow by flagging the "Return variables to the calling flow" option in the "Execute Flows" action. To enable the option you must flag also "Wait for called flows to finish" option (syncronous execution).magician wrote:I don't like to make 2 action to call flow and pass param. So here is workaround how to pass param to called flow with just single command:
Create action:
Execute flow
as Flow Pattern List put:
{a='value1'; b='value2'; f='FlowA'}
This will call flow named FlowA, inside that flow you can read local variables a and b with values 'value1' and 'value2'
Of course you can use just var a or more variables.
Caller and called flows MUST use the same variable names (local variables).
Only one calling instruction.
Re: Calling flow with param(s)
I'm sorry. Now I understand what you meant. You gave us a hint to avoid two actions. I tried what you suggested and it works perfectly. Looks like only the last assigned variable is managed as a flow name, isn't it?mcyber wrote:Not sure if my reply is what you mean, but you can pass and read variables to and from the called flow by flagging the "Return variables to the calling flow" option in the "Execute Flows" action. To enable the option you must flag also "Wait for called flows to finish" option (syncronous execution).magician wrote:I don't like to make 2 action to call flow and pass param. So here is workaround how to pass param to called flow with just single command:
Create action:
Execute flow
as Flow Pattern List put:
{a='value1'; b='value2'; f='FlowA'}
This will call flow named FlowA, inside that flow you can read local variables a and b with values 'value1' and 'value2'
Of course you can use just var a or more variables.
Caller and called flows MUST use the same variable names (local variables).
Only one calling instruction.
The only potential problems could be that you may lose some readability and, if you modify the called flow name, Automagic is no longer able to modify the calling instruction accordingly.
A very insight mechanic, anyway.
Thanks for sharing.
- TheBrain1984
- Posts: 137
- Joined: 07 Aug 2013 08:17
- Location: Germany
Re: Calling flow with param(s)
Will this also a flow called "value1" (with themcyber wrote:Not sure if my reply is what you mean, but you can pass and read variables to and from the called flow by flagging the "Return variables to the calling flow" option in the "Execute Flows" action. To enable the option you must flag also "Wait for called flows to finish" option (syncronous execution).magician wrote:I don't like to make 2 action to call flow and pass param. So here is workaround how to pass param to called flow with just single command:
Create action:
Execute flow
as Flow Pattern List put:
{a='value1'; b='value2'; f='FlowA'}
This will call flow named FlowA, inside that flow you can read local variables a and b with values 'value1' and 'value2'
Of course you can use just var a or more variables.
Caller and called flows MUST use the same variable names (local variables).
Only one calling instruction.
value of value1)?
Re: Calling flow with param(s)
To mcyber:
Yes, exactly! There is no problem to do same thing with 2 actions: first is SCRIPT to set values to variables and second is EXECUTE FLOW,
however in my flow I call one "subflow" about 10 times and I only need to change parameter. So I found this solution how to call flow with param defined directly in EXECUTE FLOW. In my case the readability was better using this "just EXECUTE FLOW" method
To TheBrain1984:
Generally, this:
{a='value1'; b='value2'; f='FlowA'}
sets all 3 values to variables a,b,f
+ finally as a result it "returns" last command value and put this to EXECUTE FLOW command ... see manual for more details.
So this should also work:
{a='value1'; f='FlowA'}
Also ok:
{a='value1'; xxxx='FlowA'}
Also ok (but you just set variable f, and last command has to be name of called flow
{f='FlowA'}
Yes, exactly! There is no problem to do same thing with 2 actions: first is SCRIPT to set values to variables and second is EXECUTE FLOW,
however in my flow I call one "subflow" about 10 times and I only need to change parameter. So I found this solution how to call flow with param defined directly in EXECUTE FLOW. In my case the readability was better using this "just EXECUTE FLOW" method
To TheBrain1984:
Generally, this:
{a='value1'; b='value2'; f='FlowA'}
sets all 3 values to variables a,b,f
+ finally as a result it "returns" last command value and put this to EXECUTE FLOW command ... see manual for more details.
So this should also work:
{a='value1'; f='FlowA'}
Also ok:
{a='value1'; xxxx='FlowA'}
Also ok (but you just set variable f, and last command has to be name of called flow
{f='FlowA'}