javascript inside of a custom AB function using parameters


Ryan Sytsma

I wrote a custom AB function with 2 parameters: "contract_name" and "active".

The AB function has some javascript in it using the tags StartJS/EndJS. I want to use the parameters passed into the AB function inside of the javascript.

Can the javascript consume the AB parameter values by using:

?

Thanks



DecSoft

Hello Ryan,

First of all, remember that we can prepare two kind of functions: with AB code or with pure Javascript. I refer this because, use the StartJS and EndJS inside a function is perfectly possible, of course, but, if we plain to use only Javascript code... then maybe it's better to prepare a Javascript function, instead of an AB code function.

Anyway, in both cases, AB functions and Javascript functions, the arguments can be used "as is". So, if you define an argument like "MyArgument", a variable with that name is available inside both kind of functions.



Ryan Sytsma

The reason I ask is because I have a good number of JS functions for a sqlite plugin that I was thinking of wrapping in AB functions to make them easier to use in the UI views and events. Each of these AB functions would have multiple argument parameters that would be used in the JS portion of the AB function.

In my opinion, calling a "wrapper" AB function is easier in the views than setting up a JS function in the views

The JS functions are basically for CRUD operations and will be used in many locations of the program but will not change. Therefore I thought an AB "wrapper" function would be easier to call the JS functions multiple times in multiple locations. That is why I was asking about the window.App.RootScope object



DecSoft

Hello Ryan,

Well. I am not sure if can understand... that is... if you want to use the "RootScope" there is no problem, for example, if you want to place some function's argument in a global variable, you can do it. So maybe I am not understanding well the question point?



Ryan Sytsma

No problem David! I have my answer. :) I appreciate your prompt help.



DecSoft

You're welcome, Ryan! :-)


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.