Page 1 of 1

Use return from macro

Posted: Sun Mar 29, 2020 5:53 pm
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!!

Re: Use return from macro

Posted: Sun Mar 29, 2020 6:22 pm
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.

Re: Use return from macro

Posted: Sun Mar 29, 2020 11:51 pm
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 2808 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".

Re: Use return from macro

Posted: Mon Mar 30, 2020 7:23 am
by kersing
Have you checked if the macro checkRX() requires any parameters?