Adds a string of client information which gets stored on the server, and can be viewed on the Clients page of Servoy Server Administration Console. The new piece of client information is added on behalf of the running Servoy client. This function can be called more than once, if you want to add multiple lines of client information. NOTE: This function can also be used with the function <em>getClientCountForInfo</em> to count the number of clients with matching addditional client information.
Parameters
Stringinfo A line of text to be added as additional client information
on behalf of the running Servoy client.
Returns: void
Sample
application.addClientInfo('SaaS company name');application.addClientInfo('For any issues call +31-SA-AS');
assert(condition, message)
This assert method can be used to check for conditions in the code.
A message can be give that will then end up in the log file (with the stacktrace where this failed).
If the condition is false and your are in developer then also the debugger will stop on this line by default.
Parameters
Booleancondition If flase then the assert is wrong and the message will be printed, debugger will stop on this line.
Stringmessage The message to display if the condition is false.
Returns: void
Sample
application.assert(userId !=null,"User id should not be null");
closeAllWindows()
Close all visible windows (except main application window). Returns true if operation was successful.
Returns:Boolean Boolean true if all windows were closed and false otherwise.
Sample
var win =application.createWindow("aWindowName",JSWindow.DIALOG,null);win.setInitialBounds(10,10,300,300);win.title ="This is a window";controller.show(win);var win2 =application.createWindow("anotherWindowName",JSWindow.DIALOG,null);win2.setInitialBounds(100,100,300,300);win2.title ="This is another window";controller.show(win2);var qdialog =plugins.dialogs.showQuestionDialog("QuestionDialog","Do you want to close the windows?","Yes","No");if (qdialog =="Yes") {application.closeAllWindows();controller.show(null);}
closeSolution()
Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.
If the user has been logged in, this function keeps the user logged in and in the newly open solution, the login is skipped and the solution goes straight to the first form.
If you want to go to a different url, you need to call application.showURL(url) before calling application.closeSolution() (this is only applicable for Web Client).
An alternative option is security.logout() which also does a log out for the user (for solutions that require authentication).
Returns: void
Sample
//application.showURL('http://www.servoy.com', '_self'); //Web Client onlyapplication.closeSolution();//close current solution, open solution 'solution_name', call global method 'global_method_name' with argument 'my_argument'.
//if the user has been logged in, he will stay logged in//application.closeSolution('solution_name','global_method_name','my_argument');//application.closeSolution('solution_name', {a: 'my_string_argument', p1: 'param1', p2: 'param2'});//close current solution, open solution 'solution_name', call solution's onOpen with argument 'my_argument' and queryParams p1,p2
//Note: specifying a solution will not work in the Developer due to debugger dependencies//specified solution should be of compatible type with client (normal type or client specific(Smart client only/Web client only) type )
closeSolution(solutionToLoad)
Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.
If the user has been logged in, this function keeps the user logged in and in the newly open solution, the login is skipped and the solution goes straight to the first form.
If you want to go to a different url, you need to call application.showURL(url) before calling application.closeSolution() (this is only applicable for Web Client).
An alternative option is security.logout() which also does a log out for the user (for solutions that require authentication).
//application.showURL('http://www.servoy.com', '_self'); //Web Client onlyapplication.closeSolution();//close current solution, open solution 'solution_name', call global method 'global_method_name' with argument 'my_argument'.
//if the user has been logged in, he will stay logged in//application.closeSolution('solution_name','global_method_name','my_argument');//application.closeSolution('solution_name', {a: 'my_string_argument', p1: 'param1', p2: 'param2'});//close current solution, open solution 'solution_name', call solution's onOpen with argument 'my_argument' and queryParams p1,p2
//Note: specifying a solution will not work in the Developer due to debugger dependencies//specified solution should be of compatible type with client (normal type or client specific(Smart client only/Web client only) type )
closeSolution(solutionToLoad, methodArgument)
Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.
If the user has been logged in, this function keeps the user logged in and in the newly open solution, the login is skipped and the solution goes straight to the first form.
If you want to go to a different url, you need to call application.showURL(url) before calling application.closeSolution() (this is only applicable for Web Client).
An alternative option is security.logout() which also does a log out for the user (for solutions that require authentication).
ObjectmethodArgument Argument passed to the solution onOpen
Returns: void
Sample
//application.showURL('http://www.servoy.com', '_self'); //Web Client onlyapplication.closeSolution();//close current solution, open solution 'solution_name', call global method 'global_method_name' with argument 'my_argument'.
//if the user has been logged in, he will stay logged in//application.closeSolution('solution_name','global_method_name','my_argument');//application.closeSolution('solution_name', {a: 'my_string_argument', p1: 'param1', p2: 'param2'});//close current solution, open solution 'solution_name', call solution's onOpen with argument 'my_argument' and queryParams p1,p2
//Note: specifying a solution will not work in the Developer due to debugger dependencies//specified solution should be of compatible type with client (normal type or client specific(Smart client only/Web client only) type )
closeSolution(solutionToLoad, methodName)
Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.
If the user has been logged in, this function keeps the user logged in and in the newly open solution, the login is skipped and the solution goes straight to the first form.
If you want to go to a different url, you need to call application.showURL(url) before calling application.closeSolution() (this is only applicable for Web Client).
An alternative option is security.logout() which also does a log out for the user (for solutions that require authentication).
StringmethodName Name of the global method to call
Returns: void
Sample
//application.showURL('http://www.servoy.com', '_self'); //Web Client onlyapplication.closeSolution();//close current solution, open solution 'solution_name', call global method 'global_method_name' with argument 'my_argument'.
//if the user has been logged in, he will stay logged in//application.closeSolution('solution_name','global_method_name','my_argument');//application.closeSolution('solution_name', {a: 'my_string_argument', p1: 'param1', p2: 'param2'});//close current solution, open solution 'solution_name', call solution's onOpen with argument 'my_argument' and queryParams p1,p2
//Note: specifying a solution will not work in the Developer due to debugger dependencies//specified solution should be of compatible type with client (normal type or client specific(Smart client only/Web client only) type )
Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.
If the user has been logged in, this function keeps the user logged in and in the newly open solution, the login is skipped and the solution goes straight to the first form.
If you want to go to a different url, you need to call application.showURL(url) before calling application.closeSolution() (this is only applicable for Web Client).
An alternative option is security.logout() which also does a log out for the user (for solutions that require authentication).
StringmethodName Name of the global method to call
ObjectmethodArgument Argument passed to the global method
Returns: void
Sample
//application.showURL('http://www.servoy.com', '_self'); //Web Client onlyapplication.closeSolution();//close current solution, open solution 'solution_name', call global method 'global_method_name' with argument 'my_argument'.
//if the user has been logged in, he will stay logged in//application.closeSolution('solution_name','global_method_name','my_argument');//application.closeSolution('solution_name', {a: 'my_string_argument', p1: 'param1', p2: 'param2'});//close current solution, open solution 'solution_name', call solution's onOpen with argument 'my_argument' and queryParams p1,p2
//Note: specifying a solution will not work in the Developer due to debugger dependencies//specified solution should be of compatible type with client (normal type or client specific(Smart client only/Web client only) type )
StringnewInstanceScriptName Name of the new form instance
Returns:Boolean Boolean (true) if the instance was created succesfully, (false) otherwise
Sample
var ok =application.createNewFormInstance('orders','orders_view');if (ok){var dialog =application.createWindow("myDialog",JSWindow.DIALOG);dialog.show('orders_view')//forms['orders_view'].controller.show()//forms.xyz.elements.myTabPanel.addTab(forms['orders_view'])//forms['orders_view'].elements.mylabel.setLocation(10,20)}
createWindow(windowName, type)
Creates a new window that can be used for displaying forms. Initially the window is not visible.
If there is already a window with the given name, it will be closed and destroyed prior to creating the new window.
Use the form controller show() and showRecords() methods in order to show a form in this window.
Parameters
StringwindowName the name of the window. Should not be null.
Numbertype the type of the window. Can be one of JSWindow.DIALOG, JSWindow.MODAL_DIALOG, JSWindow.WINDOW. (WINDOW does not work for NGClient)
// create and show a window, with specified title, initial location and size// type of the window can be one of JSWindow.DIALOG, JSWindow.MODAL_DIALOG, JSWindow.WINDOW (WINDOW does not work for NGClient)
// If parentWindow is not specified, the current window will be used as parent; parentWindow parameter is only used by dialogs
var win =application.createWindow("windowName",JSWindow.DIALOG);win.setInitialBounds(10,10,300,300);win.title ="This is a window";controller.show(win);// create and show a non-modal dialog with default initial bounds/titlevar nmd =application.createWindow("nonModalDialogName",JSWindow.DIALOG);controller.showRecords(15, nmd); // 15 is a single-number pk in this case
createWindow(windowName, type, parentWindow)
Creates a new window that can be used for displaying forms. Initially the window is not visible.
If there is already a window with the given name, it will be closed and destroyed prior to creating the new window.
Use the form controller show() and showRecords() methods in order to show a form in this window.
Parameters
StringwindowName the name of the window. Should not be null.
Numbertype the type of the window. Can be one of JSWindow.DIALOG, JSWindow.MODAL_DIALOG, JSWindow.WINDOW (WINDOW doesn't work in NGClient).
JSWindowparentWindow the parent JSWindow object. If it is not specified, the current window will be used as parent. This parameter is only used by dialogs.
// create and show a window, with specified title, initial location and size (WINDOW does not work for NGClient)var win =application.createWindow("windowName",JSWindow.DIALOG);win.setInitialBounds(10,10,300,300);win.title ="This is a window";controller.show(win);// create and show a non-modal dialog with default initial bounds/titlevar nmd =application.createWindow("nonModalDialogName",JSWindow.DIALOG);controller.showRecords(15, nmd); // 15 is a single-number pk in this case
executeLater(function, delay)
Runs at method at the given delay in milliseconds.
This is like a simple scheduler to quickly run something after a bit of delay
Numberdelay The millis that has to elapse before the function is called.
Arrayarguments The arguments that are given to the function when called.
Returns: void
executeProgram(program)
Execute a program and returns output. Specify the cmd as you would do in a console.
Parameters
Stringprogram (fullpath) of the program to execute
Returns:String The output generated by the program execution.
Sample
// For Windows systems:// Runs a binary located in the user's home directory. The application will run in the current working// directory, which in general is the one where Servoy was started from.application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1","arg2","arg3"]);// The same as above, but run the application in the user's home directory.application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1","arg2","arg3"],null,"c:\\Users\\myself\\");// The same as above, but also set an environment variable for the called program.application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "c:\\Users\\myself\\");
// For non-Windows systems:application.executeProgram("/home/myself/myapp", ["arg1","arg2","arg3"]);application.executeProgram("/home/myself/myapp", ["arg1","arg2","arg3"],null,"/home/myself/");application.executeProgram("/home/myself/myapp", ["arg1","arg2","arg3"], ["MY_ENV_VAR=something"],"/home/myself/");// Open a file with the default application associated with it. (on Windows)application.executeProgram("rundll32.exe", ["url.dll,FileProtocolHandler","filename"]);// Open a file with the default application associated with it. (on Linux)application.executeProgram("xdg-open", ["filename"]);// Open a file with the default application associated with it. (on MacOS)application.executeProgram("open", ["filename"]);// Open a file with a specific application (on MacOS).application.executeProgram("open", ["-a","OpenOffice.org.app","filename.doc"]);
executeProgram(program, params)
Execute a program and returns output. Specify the cmd as you would do in a console.
Parameters
Stringprogram (fullpath) of the program to execute
Arrayparams an array of strings as program arguments
Returns:String The output generated by the program execution.
Sample
// For Windows systems:// Runs a binary located in the user's home directory. The application will run in the current working// directory, which in general is the one where Servoy was started from.application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1","arg2","arg3"]);// The same as above, but run the application in the user's home directory.application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1","arg2","arg3"],null,"c:\\Users\\myself\\");// The same as above, but also set an environment variable for the called program.application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "c:\\Users\\myself\\");
// For non-Windows systems:application.executeProgram("/home/myself/myapp", ["arg1","arg2","arg3"]);application.executeProgram("/home/myself/myapp", ["arg1","arg2","arg3"],null,"/home/myself/");application.executeProgram("/home/myself/myapp", ["arg1","arg2","arg3"], ["MY_ENV_VAR=something"],"/home/myself/");// Open a file with the default application associated with it. (on Windows)application.executeProgram("rundll32.exe", ["url.dll,FileProtocolHandler","filename"]);// Open a file with the default application associated with it. (on Linux)application.executeProgram("xdg-open", ["filename"]);// Open a file with the default application associated with it. (on MacOS)application.executeProgram("open", ["filename"]);// Open a file with a specific application (on MacOS).application.executeProgram("open", ["-a","OpenOffice.org.app","filename.doc"]);
executeProgram(program, params, environmentVars)
Execute a program and returns output. Specify the cmd as you would do in a console.
Parameters
Stringprogram (fullpath) of the program to execute
Arrayparams an array of strings as program arguments
ArrayenvironmentVars array of strings, each element of which has environment variable settings in the format name=value, or null if the subprocess should inherit the environment of the current process.
Returns:String The output generated by the program execution.
Sample
// For Windows systems:// Runs a binary located in the user's home directory. The application will run in the current working// directory, which in general is the one where Servoy was started from.application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1","arg2","arg3"]);// The same as above, but run the application in the user's home directory.application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1","arg2","arg3"],null,"c:\\Users\\myself\\");// The same as above, but also set an environment variable for the called program.application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "c:\\Users\\myself\\");
// For non-Windows systems:application.executeProgram("/home/myself/myapp", ["arg1","arg2","arg3"]);application.executeProgram("/home/myself/myapp", ["arg1","arg2","arg3"],null,"/home/myself/");application.executeProgram("/home/myself/myapp", ["arg1","arg2","arg3"], ["MY_ENV_VAR=something"],"/home/myself/");// Open a file with the default application associated with it. (on Windows)application.executeProgram("rundll32.exe", ["url.dll,FileProtocolHandler","filename"]);// Open a file with the default application associated with it. (on Linux)application.executeProgram("xdg-open", ["filename"]);// Open a file with the default application associated with it. (on MacOS)application.executeProgram("open", ["filename"]);// Open a file with a specific application (on MacOS).application.executeProgram("open", ["-a","OpenOffice.org.app","filename.doc"]);
Execute a program and returns output. Specify the cmd as you would do in a console.
Parameters
Stringprogram (fullpath) of the program to execute
Arrayparams an array of strings as program arguments
ArrayenvironmentVars array of strings, each element of which has environment variable settings in the format name=value, or null if the subprocess should inherit the environment of the current process.
StringstartDir the working directory of the subprocess, or null if the subprocess should inherit the working directory of the current process.
Returns:String The output generated by the program execution.
Sample
// For Windows systems:// Runs a binary located in the user's home directory. The application will run in the current working// directory, which in general is the one where Servoy was started from.application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1","arg2","arg3"]);// The same as above, but run the application in the user's home directory.application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1","arg2","arg3"],null,"c:\\Users\\myself\\");// The same as above, but also set an environment variable for the called program.application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "c:\\Users\\myself\\");
// For non-Windows systems:application.executeProgram("/home/myself/myapp", ["arg1","arg2","arg3"]);application.executeProgram("/home/myself/myapp", ["arg1","arg2","arg3"],null,"/home/myself/");application.executeProgram("/home/myself/myapp", ["arg1","arg2","arg3"], ["MY_ENV_VAR=something"],"/home/myself/");// Open a file with the default application associated with it. (on Windows)application.executeProgram("rundll32.exe", ["url.dll,FileProtocolHandler","filename"]);// Open a file with the default application associated with it. (on Linux)application.executeProgram("xdg-open", ["filename"]);// Open a file with the default application associated with it. (on MacOS)application.executeProgram("open", ["filename"]);// Open a file with a specific application (on MacOS).application.executeProgram("open", ["-a","OpenOffice.org.app","filename.doc"]);
executeProgramInBackground(program)
Execute a program in the background. Specify the cmd as you would do in a console.
Parameters
Stringprogram (fullpath) of the program to execute
Returns: void
Sample
// For Windows systems:// Runs a binary located in the user's home directory. The application will run in the current working// directory, which in general is the one where Servoy was started from.application.executeProgramInBackground("c:\\Users\\myself\\myapp.exe", ["arg1","arg2","arg3"]);// The same as above, but run the application in the user's home directory.application.executeProgramInBackground("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], null, "c:\\Users\\myself\\");
// The same as above, but also set an environment variable for the called program.application.executeProgramInBackground("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "c:\\Users\\myself\\");
// For non-Windows systems:application.executeProgramInBackground("/home/myself/myapp", ["arg1","arg2","arg3"]);application.executeProgramInBackground("/home/myself/myapp", ["arg1","arg2","arg3"],null,"/home/myself/");application.executeProgramInBackground("/home/myself/myapp", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "/home/myself/");
// Open a file with the default application associated with it. (on Windows)application.executeProgramInBackground("rundll32.exe", ["url.dll,FileProtocolHandler","filename"]);// Open a file with the default application associated with it. (on Linux)application.executeProgramInBackground("xdg-open", ["filename"]);// Open a file with the default application associated with it. (on MacOS)application.executeProgramInBackground("open", ["filename"]);// Open a file with a specific application (on MacOS).application.executeProgram("open", ["-a","OpenOffice.org.app"