Use return from macro

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Use return from macro

Post by MJU »

I've got a macro (lest say: Macro_1), and I've made a local variable .Return
In the macro, I set .Return to 0 if something didn't work, and to 1 when it ran successfully.

From what I've read the .Return should now be used globally to check if the macro ran successfully?

How can I check in another macro if the macro ran OK?
I want to check this returnvalue with a decision macro, should this look like this:

if Macro_1(.return) then?

How can I check in a decision of the macro returned a certain value?

Thanks!!

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Use return from macro

Post by kersing »

The macro call will be the value. So

Code: Select all

if Macro_1() then
In a decision you just enter 'Macro_1()' for the 'if:'.
If your macro requires arguments (say 2) you enter 'Macro_1(1,"second")' or 'Macro_1(.var1, .var2)' if you want to pass the values of local var1 and var2.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times
Contact:

Re: Use return from macro

Post by MJU »

kersing wrote:The macro call will be the value. So

Code: Select all

if Macro_1() then
In a decision you just enter 'Macro_1()' for the 'if:'.
If your macro requires arguments (say 2) you enter 'Macro_1(1,"second")' or 'Macro_1(.var1, .var2)' if you want to pass the values of local var1 and var2.
Thanks for your advice! Again! :-)

I've tried this in a new flowchart and this works..
But when I try this in an existing flowchart I get the error that there are to few arguments.
txt.jpg
txt.jpg (105.01 KiB) Viewed 1905 times
The macro it refers to has a .Return which is set (according to it's success or failure), 0 or 1.
But in this case it doesn't work :(
The return value for the macro is set to "BOOL".

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Use return from macro

Post by kersing »

Have you checked if the macro checkRX() requires any parameters?
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Post Reply