Posted Sat, 18 Aug 2018 03:44:54 GMT by

Hi,

I have a task that calls a function called TriggerParsing.  Within the TriggerParsing, I call function Abbreviate about 10 times.  

Can I have a function call a function?

The reason I ask is that nothing gets returned back to function TriggerParsing from function Abbreviate.  I placed DIALOG commands and can tell that at the end of function Abbreviate there is data in the variable but not on the next statement after it returns to TriggerParsing.

The variable is defined in function 1 and is also defined as the only parameter in function 2 and the function call has it defined as a return value.

Thanks,

Rich

Posted Sat, 18 Aug 2018 03:46:08 GMT by

Forgot to mention I am using AM 10 on Window Server 2012 R2 Standard.

Posted Mon, 20 Aug 2018 15:27:52 GMT by

Tried adding the variable in the Task variables instead in the first function? Check Task variables in the Help

Posted Mon, 20 Aug 2018 22:09:55 GMT by

Hi Rich,

Mats is correct, in this case you would want to create one or more Task Variables. A task variable is created when the task starts and is available in the entire task. This allows you to access and set values in one function, then call that value and even alter it in another function. When using the Create variable step action, that variable is available only within that function.  

Posted Tue, 21 Aug 2018 01:42:36 GMT by

Hi,

So far I got it to work using a task variable. 

 

However, I thought a parameter would be passed on the function like this.

      call function(parameter1, parameter2, etc.)

 

Also typically in a function you have a statement like the following that signifies what is returned from the function. 

      return()  or

      return(0)

 

How does one do that from within an Automate function?

 

Thanks, Rich

Posted Tue, 21 Aug 2018 10:06:48 GMT by

Hello Rich,

in the AM10 TaskBuilder, look at the line where you select the function you are working on.  At the right hand edge of that line is a grid type button, immediately right of the red 'x'.  Clicking that shows an area which allows you to define the parameters to the function, and nearby you can also specify the return type.

When calling the function, you simply pass the parameters in the usual way (they are passed by value, not by reference)

Finally, to return a value from the function, go to the Variable group of actions and in there is a Return action which should do what you need.

 

I hope that helps!

 

You must be signed in to post in this forum.