Server Side Procedures - Parameter Passing Examples
From Lianjapedia
Revision as of 11:06, 11 February 2020 by Yvonne.milne (Talk | contribs)
Overview
For an overview of using server side procedures with the Lianja Web Client and Lianja Cloud Server, see here.
Lianja/VFP Server Side Procedures
exports.conf
A function can be called directly if it is declared in exports.conf.
var result = mylibproc();
Lianja.evaluate()
The Lianja.evaluate() method can be used to call a Lianja/VFP function/procedure.
var result = Lianja.evaluate("myproc()");
To call a procedure in a library, prefix the procedure name with the library name and '::'.
var result = Lianja.evaluate("mylib::mylibproc()");
Note how to build up the string passed to Lianja.evaluate() when using local variables:
Numeric variables:
var num5 = 5; var num6 = 7; var result = Lianja.evaluate("mylib::mylibproc(" + num5 + "," + num6 + ")");
String variables (include quotes):
var num7 = "5"; var num8 = "7"; var result = Lianja.evaluate("mylib::mylibproc('" + num7 + "','" + num8 + "')");
Macro substitution with {} can be used on globals:
Numeric:
num1 = 5; num2 = 7; var result = Lianja.evaluate("mylib::mylibproc({num1},{num2})");
Strings (include quotes):
num3 = "5"; num4 = "7"; var result = Lianja.evaluate("mylib::mylibproc('{num3}','{num4}')");