AppBuilder custom functions


Ryan Sytsma
I wrote some custom Javascript functions in the AB functions area.

How can I call this function and assign the return value to a variable? If it is JS does it need to wrapped in the StartJS/EndJS tags?

Ryan

Ryan Sytsma
Here is an example of what I am doing: As you can see, I am assuming I can set a variable in the StartJS/EndJS.
Would I do the same thing with passing arguements in JS? Does the "window.App.RootScope.SomeVariable" allow me to pass AB vars into a JS function? Ryan

DecSoft

Hello Ryan,

AB functions (with AB code) can't provide a "return", so, if we need that an AB function do something and be ready for a result, that function must place the result in an app variable, that we can use after call to the AB function.

AB functions (with Javascript) can provide a "return" value, but, this is intented to be use if we call to the AB function from Javascript. In other case, if we call the function from AB code, we need to use an app variable like above.

Both AB functions (with AB code and with Javascript code) support arguments, of course, and we can pass AB variables to it. Remember that there is a way to access AB stuff (including variables) from Javascript code: read help topic.

Please, Ryan, go ahead if you need any further help.



Ryan Sytsma
So would this be a legal way of getting a return value from an AB JS function?

DecSoft

Hello Ryan,

I commit a mistake in my previous post. Certainly, Javascript AB functions can return something, and, I mention that AB functions can't do it, but, in fact can do it, using the "Return" action, which is intended to be used when calling the function from Javascript. So in both cases AB and Javascript functions we can do something like this using Javascript:

Note how we call to the app function, see this help topic for more information. Take a look also at the "External" and "External2" app samples.


Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.

Este sitio utiliza "cookies" útiles para almacenar sus preferencias.

Bien. Ocultar esta nota. Obtener más información.