Return Types
{column:padding=0px|width=80px}{column}{column}{column}
Method Summary
void
addClientInfo(info)
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.
void
beep()
Produces a "beep" sound; commonly used to indicate an error or warning dialog.
closeAllWindows()
Close all visible windows (except main application window).
void
closeSolution()
Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.
void
closeSolution(solutionToLoad)
Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.
void
closeSolution(solutionToLoad, methodName)
Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.
void
closeSolution(solutionToLoad, methodName, methodArgument)
Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.
createNewFormInstance(designFormName, newInstanceScriptName)
Create a new form instance.
createWindow(windowName, type)
Creates a new window that can be used for displaying forms.
createWindow(windowName, type, parentWindow)
Creates a new window that can be used for displaying forms.
executeProgram(programName, [arg1], [arg2], [argN], [#], [environmentvar1], [environmentvarN], [startdirectory])
Execute a program and returns output.
void
executeProgramInBackground(programName, [arg1], [arg2], [argN], [#], [environmentvar1], [environmentvarN], [startdirectory])
Execute a program in the background.
getActiveClientCount(currentSolutionOnly)
Get the active user count on the server (can be limited to current solution).
getApplicationType()
Get the application type.
getClientCountForInfo(info)
Gets the count for all clients displaying the same additional information
in the Clients page of Servoy Server Administration Console.
getClientProperty(name)
Sets a UI property.
getClipboardString()
Gets a string from the clipboard, null if not a string or empty.
getCurrentLookAndFeelName()
Gets the name of the current Look And Feel specified in Application Preferences.
getHostName()
Get the name of the localhost.
getIPAddress()
Get the clients' IP address.
String[]
getLicenseNames()
Get the names of the used client licenses (as strings in array).
String[]
getPrinters()
Get all the printer names in an array.
getScreenHeight()
Get the screen height in pixels.
getScreenWidth()
Get the screen width in pixels.
getServerTimeStamp()
Returns a date object initialized on server with current date and time.
getServerURL()
Gets the HTTP server url.
getSolutionName()
Returns the name of the current solution.
getSolutionRelease()
Get the solution release number.
getTimeStamp()
Returns a date object initialized in client with current date and time.
getUserProperty(name)
Get a persistent user property.
String[]
getUserPropertyNames()
Get all persistent user property names.
getValueListArray(name)
Retrieve a valuelist as array, to get real-values for display-values.
getValueListDisplayValue(name, realValue)
Retrieve a valuelist display-value for a real-value.
getValueListItems(name)
Get all values from a custom or database type value list as dataset (with columns displayValue,realValue).
String[]
getValueListNames()
Get all the valuelist names as array.
getVersion()
Returns the application version.
isInDeveloper()
Returns true if the solution is running in the developer.
isLastPrintPreviewPrinted()
Check if the last printpreview did print.
void
output(msg)
Output something on the out stream.
void
output(msg, level)
Output something on the out stream.
void
overrideStyle(originalStyleName, newStyleName)
Overrides one style (defined in in a form) with another.
void
playSound(url)
Play a sound (AU file, an AIFF file, a WAV file, and a MIDI file).
putClientProperty(name, value)
Sets a UI property.
void
redo()
Redo last action (if possible).
void
removeAllClientInfo()
Removes all names given to the client via the admin page.
removeClientInfo(info)
Removes a string of client information which is stored on the server and
previously was added using the application.
void
setClipboardContent(string)
Sets a string object in the clipboard.
void
setNumpadEnterAsFocusNextEnabled(enabled)
Set if numpad enter should behave like focus next.
void
setStatusText(text)
Set the status area value.
void
setStatusText(text, tooltip)
Set the status area value.
void
setToolbarVisible(name, visible)
Make a toolbar visible or invisible.
void
setUserProperty(name, value)
Set a persistent user property.
void
setValueListItems(name, dataset)
Fill a custom type valuelist with values from array(s) or dataset.
void
setValueListItems(name, dataset, autoconvert)
Fill a custom type valuelist with values from array(s) or dataset.
void
setValueListItems(name, displayValues)
Fill a custom type valuelist with values from array(s) or dataset.
void
setValueListItems(name, displayValues, autoconvert)
Fill a custom type valuelist with values from array(s) or dataset.
void
setValueListItems(name, displayValues, realValues)
Fill a custom type valuelist with values from array(s) or dataset.
void
setValueListItems(name, displayValues, realValues, autoconvert)
Fill a custom type valuelist with values from array(s) or dataset.
showCalendar()
Show the calendar, returns selected date or null if canceled.
showCalendar(dateFormat)
Show the calendar, returns selected date or null if canceled.
showCalendar(selectedDate)
Show the calendar, returns selected date or null if canceled.
showCalendar(selectedDate, dateFormat)
Show the calendar, returns selected date or null if canceled.
showColorChooser()
Show the colorChooser.
showColorChooser(colorString)
Show the colorChooser.
showFontChooser()
Show the font chooser dialog.
showFontChooser(defaultFont)
Show the font chooser dialog.
void
showForm(form)
Show the form specified by the parameter, that can be a name (is case sensitive!) or a form object.
showI18NDialog()
Opens the i18n dialog so users can change translations.
showI18NDialog(keyToSelect)
Opens the i18n dialog so users can change translations.
showI18NDialog(keyToSelect, languageToSelect)
Opens the i18n dialog so users can change translations.
void
sleep(ms)
Sleep for specified time (in milliseconds).
void
undo()
Undo last action (if possible).
void
updateUI()
Updates the UI (painting).
void
updateUI(milliseconds)
Updates the UI (painting).
{column:padding=0px|width=100%}{column}
Method Details
void
addClientInfo
(info)
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.
Since
Replace with version info
Parameters
{String} info – A line of text to be added as additional client information
on behalf of the running Servoy client.
Returns
void
Also see
External links
Sample
application.addClientInfo('SaaS company name'); application.addClientInfo('For any issues call +31-SA-AS');
void
beep
()
Produces a "beep" sound; commonly used to indicate an error or warning dialog.
Since
Replace with version info
Parameters
Returns
void
Also see
External links
Sample
application.beep();
closeAllWindows
()
Close all visible windows (except main application window). Returns true if operation was successful.
Since
Replace with version info
Parameters
Returns
Boolean – Boolean true if all windows were closed and false otherwise.
Also see
External links
Sample
var win = application.createWindow("aWindowName", JSWindow.WINDOW, null); win.setInitialBounds(10, 10, 300, 300); win.title = "This is a window"; controller.show(win); var win2 = application.createWindow("anotherWindowName", JSWindow.WINDOW, 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); }
void
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).
Since
Replace with version info
Parameters
Returns
void
Also see
External links
Sample
//application.showURL('http://www.servoy.com', '_self'); //Web Client only application.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'); //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 )
void
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).
Since
Replace with version info
Parameters
{String} solutionToLoad – Name of the solution to load
Returns
void
Also see
External links
Sample
//application.showURL('http://www.servoy.com', '_self'); //Web Client only application.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'); //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 )
void
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).
Since
Replace with version info
Returns
void
Also see
External links
Sample
//application.showURL('http://www.servoy.com', '_self'); //Web Client only application.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'); //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 )
void
closeSolution
(solutionToLoad, methodName, 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).
Since
Replace with version info
Returns
void
Also see
External links
Sample
//application.showURL('http://www.servoy.com', '_self'); //Web Client only application.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'); //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 )
createNewFormInstance
(designFormName, newInstanceScriptName)
Create a new form instance.
Since
Replace with version info
Returns
Boolean – Boolean (true) if the instance was created succesfully, (false) otherwise
Also see
External links
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.
Since
Replace with version info
Returns
JSWindow – the newly created window.
Also see
External links
Sample
// 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 // 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.WINDOW); 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/title var 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.
Since
Replace with version info
Parameters
{String} windowName – the name of the window.
{Number} type – the type of the window. Can be one of JSWindow.DIALOG, JSWindow.MODAL_DIALOG, JSWindow.WINDOW.
{JSWindow} parentWindow – the parent JSWindow object. If it is not specified, the current window will be used as parent. This parameter is only used by dialogs.
Returns
JSWindow – the newly created window.
Also see
External links
Sample
// create and show a window, with specified title, initial location and size var win = application.createWindow("windowName", JSWindow.WINDOW); 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/title var nmd = application.createWindow("nonModalDialogName", JSWindow.DIALOG); controller.showRecords(15, nmd); // 15 is a single-number pk in this case
executeProgram
(programName, [arg1], [arg2], [argN], [#], [environmentvar1], [environmentvarN], [startdirectory])
Execute a program and returns output. Specify the cmd as you would do in a console.
Since
Replace with version info
Parameters
programName – Name (fullpath) of the program to execute
[arg1] – Argument
[arg2] – Argument
[argN] – Argument
[#] – Divider between program environment vars and startdir
[environmentvar1] – Environment variable
[environmentvarN] – Environment variable
[startdirectory] – Program start directory
Returns
String – The output generated by the program execution.
Also see
External links
Sample
// "#" is divider between program args, environment vars and startdir // 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", "#", "#", "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", "#", "#", "/home/myself/"); application.executeProgram("/home/myself/myapp", "arg1", "arg2", "arg3", "#", "MY_ENV_VAR=something", "#", "/home/myself/myapp"); // 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");
void
executeProgramInBackground
(programName, [arg1], [arg2], [argN], [#], [environmentvar1], [environmentvarN], [startdirectory])
Execute a program in the background. Specify the cmd as you would do in a console.
Since
Replace with version info
Parameters
programName – Name (fullpath) of the program to execute
[arg1] – Argument
[arg2] – Argument
[argN] – Argument
[#] – Divider between program environment vars and startdir
[environmentvar1] – Environment variable
[environmentvarN] – Environment variable
[startdirectory] – Program start directory
Returns
void
Also see
External links
Sample
// "#" is divider between program args, environment vars and startdir // 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", "#", "#", "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", "#", "#", "/home/myself/"); application.executeProgramInBackground("/home/myself/myapp", "arg1", "arg2", "arg3", "#", "MY_ENV_VAR=something", "#", "/home/myself/myapp"); // 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.executeProgramInBackground("open", "-a", "OpenOffice.org.app", "filename.doc");
void
exit
()
Stop and exit application.
Since
Replace with version info
Parameters
Returns
void
Also see
External links
Sample
// exit application application.exit();
getActiveClientCount
(currentSolutionOnly)
Get the active user count on the server (can be limited to current solution).
Since
Replace with version info
Parameters
{Boolean} currentSolutionOnly – Boolean (true) to get the active user count on server only to the current solution
Returns
Number – Active user count on the server
Also see
External links
Sample
var count = application.getActiveClientCount(true);
getApplicationType
()
Get the application type.
Since
Replace with version info
Parameters
Returns
Number – Constant application type
Also see
External links
Sample
var type = application.getApplicationType(); //see application type contstant
getClientCountForInfo
(info)
Gets the count for all clients displaying the same additional information
in the Clients page of Servoy Server Administration Console.
Since
Replace with version info
Parameters
{String} info – The additional client info string to search for.
Returns
Number – Number of clients
Also see
External links
Sample
var count = application.getClientCountForInfo('SaaS company name'); application.output('Including yourself, there are ' + count + ' client(s) running on behalf of the company.');
getClientProperty
(name)
Sets a UI property.
Since
Replace with version info
Parameters
{Object} name – Name of the client property
Returns
Object – the property value for the given name/key, null of nothing was found
Also see
External links
Sample
//Only use this function from the solution on open method! //In smart client, use this to set javax.swing.UIDefaults properties. application.putClientProperty('ToolTip.hideAccelerator', true) //To change the comboboxes selection background color, do this: application.putClientProperty('ComboBox.selectionBackground', new Packages.javax.swing.plaf.ColorUIResource(java.awt.Color.RED)) //In web client, use this to change the template directory. //To change the default dir of templates/default to templates/green_skin, do this: application.putClientProperty('templates.dir','green_skin');
getClipboardString
()
Gets a string from the clipboard, null if not a string or empty.
Since
Replace with version info
Parameters
Returns
String – The string from the clipboard
Also see
External links
Sample
var fromClipboard = application.getClipboardString();
getCurrentLookAndFeelName
()
Gets the name of the current Look And Feel specified in Application Preferences.
Since
Replace with version info
Parameters
Returns
String – Current Look And Feel
Also see
External links
Sample
var laf = application.getCurrentLookAndFeelName();
getHostName
()
Get the name of the localhost.
Since
Replace with version info
Parameters
Returns
String – Name of the localhost
Also see
External links
Sample
var hostName = application.getHostName();
getIPAddress
()
Get the clients' IP address.
Since
Replace with version info
Parameters
Returns
String – IP address of the client
Also see
External links
Sample
var ip = application.getIPAddress();
String[]
getLicenseNames
()
Get the names of the used client licenses (as strings in array).
Since
Replace with version info
Parameters
Returns
String[] – Client licenses names
Also see
External links
Sample
var array = application.getLicenseNames();
getOSName
()
Returns the name of the operating system.
Since
Replace with version info
Parameters
Returns
String – Name of the operating system
Also see
External links
Sample
var osname = application.getOSName();
String[]
getPrinters
()
Get all the printer names in an array.
Since
Replace with version info
Parameters
Returns
String[] – All printer names
Also see
External links
Sample
var printersArray = application.getPrinters();
getScreenHeight
()
Get the screen height in pixels.
Since
Replace with version info
Parameters
Returns
Number – Screen height
Also see
External links
Sample
var height = application.getScreenHeight();
getScreenWidth
()
Get the screen width in pixels.
Since
Replace with version info
Parameters
Returns
Number – Screen width
Also see
External links
Sample
var width = application.getScreenWidth();
getServerTimeStamp
()
Returns a date object initialized on server with current date and time.
Since
Replace with version info
Parameters
Returns
Date – Server time
Also see
External links
Sample
var servertime = application.getServerTimeStamp();
getServerURL
()
Gets the HTTP server url.
Since
Replace with version info
Parameters
Returns
String – HTTP server URL
Also see
External links
Sample
var url = application.getServerURL();
getSolutionName
()
Returns the name of the current solution.
Since
Replace with version info
Parameters
Returns
String – Current solution name
Also see
External links
Sample
var solutionName = application.getSolutionName();
getSolutionRelease
()
Get the solution release number.
Since
Replace with version info
Parameters
Returns
Number – Current solution release number
Also see
External links
Sample
var release = application.getSolutionRelease();
getTimeStamp
()
Returns a date object initialized in client with current date and time.
Since
Replace with version info
Parameters
Returns
Date – Current time at the client
Also see
External links
Sample
var clienttime = application.getTimeStamp();
Get a new UUID object (also known as GUID) or convert the parameter (that can be string or byte array) to an UUID object. A table column marked as UUID will work with such objects.
Since
Replace with version info
Parameters
Returns
UUID – The new UUID object
Also see
External links
Sample
var new_uuid_object = application.getUUID(); // generate new uuid object var uuid_object1 = application.getUUID(new_uuid_object.toString()); // convert a string representing an uuid to an uuid object var uuid_object2 = application.getUUID(new_uuid_object.toBytes()); // convert a byte array representing an uuid to an uuid object
getUUID
(byteArray)
Get a new UUID object (also known as GUID) or convert the parameter (that can be string or byte array) to an UUID object. A table column marked as UUID will work with such objects.
Since
Replace with version info
Parameters
{byte[]} byteArray – Byte array representing an uuid
Returns
UUID – The new UUID object
Also see
External links
Sample
var new_uuid_object = application.getUUID(); // generate new uuid object var uuid_object1 = application.getUUID(new_uuid_object.toString()); // convert a string representing an uuid to an uuid object var uuid_object2 = application.getUUID(new_uuid_object.toBytes()); // convert a byte array representing an uuid to an uuid object
getUUID
(uuidString)
Get a new UUID object (also known as GUID) or convert the parameter (that can be string or byte array) to an UUID object. A table column marked as UUID will work with such objects.
Since
Replace with version info
Parameters
{String} uuidString – String representing an uuid
Returns
UUID – The new UUID object
Also see
External links
Sample
var new_uuid_object = application.getUUID(); // generate new uuid object var uuid_object1 = application.getUUID(new_uuid_object.toString()); // convert a string representing an uuid to an uuid object var uuid_object2 = application.getUUID(new_uuid_object.toBytes()); // convert a byte array representing an uuid to an uuid object
getUserProperty
(name)
Get a persistent user property.
Since
Replace with version info
Parameters
{String} name – Name of the property
Returns
String – Property value
Also see
External links
Sample
var value = application.getUserProperty('showOrders');
String[]
getUserPropertyNames
()
Get all persistent user property names.
Since
Replace with version info
Parameters
Returns
String[] – Array of all user property names
Also see
External links
Sample
// display all user properties allPropertyNames = application.getUserPropertyNames(); for(var i = 0; i < allPropertyNames.length; i++) { application.output(allPropertyNames[i] + " = " + application.getUserProperty(allPropertyNames[i])); }
getValueListArray
(name)
Retrieve a valuelist as array, to get real-values for display-values.
NOTE: this doesn't return a value for a valuelist that depends on a database relation or is a global method valuelist.
Since
Replace with version info
Parameters
{String} name – The name of the valuelist
Returns
Array – Named array for the valuelist
Also see
External links
Sample
var packet_types = application.getValueListArray('packet_types'); if (a_realValue == packet_types['displayValue']) { }
getValueListDisplayValue
(name, realValue)
Retrieve a valuelist display-value for a real-value.
NOTE: this doesn't return a value for a valuelist that depends on a database relation or is a global method valuelist.
Since
Replace with version info
Returns
Object – Display value of the real value from the valuelist
Also see
External links
Sample
var displayable_status = application.getValueListDisplayValue('case_status',status);
getValueListItems
(name)
Get all values from a custom or database type value list as dataset (with columns displayValue,realValue).
NOTE: this doesn't return a value for a valuelist that depends on a database relation or is a global method valuelist.
Since
Replace with version info
Parameters
{String} name – Name of the valuelist
Returns
JSDataSet – DataSet with valuelist's display values and real values
Also see
External links
Sample
//Note:see databaseManager.JSDataSet for full details of dataset var dataset = application.getValueListItems('my_en_types'); //example to calc a strange total global_total = 0; for( var i = 1 ; i <= dataset.getMaxRowIndex() ; i++ ) { global_total = global_total + dataset.getValue(i,1); } //example to assign to dataprovider //employee_salary = dataset.getValue(1,1)
String[]
getValueListNames
()
Get all the valuelist names as array.
Since
Replace with version info
Parameters
Returns
String[] – Array with all valuelist names
Also see
External links
Sample
var array = application.getValueListNames();
getVersion
()
Returns the application version.
Since
Replace with version info
Parameters
Returns
String – Application version
Also see
External links
Sample
application.getVersion();
getWindow
()
Get the main application window.
Since
Replace with version info
Parameters
Returns
JSWindow – the main application JSWindow.
Also see
External links
Sample
// close and dispose window resources var mainAppWindow = application.getWindow();
getWindow
(name)
Get a window by window name. When not supplying a name, the main application window is grabbed.
Since
Replace with version info
Parameters
{String} name – the name of the window. If not specified, the main application JSWindow will be returned.
Returns
JSWindow – the JSWindow with the specified name, or null if no such window exists.
Also see
External links
Sample
// close and dispose window resources var win = application.getWindow("someWindowName"); if (win != null) { win.destroy(); }
isInDeveloper
()
Returns true if the solution is running in the developer.
Since
Replace with version info
Parameters
Returns
Boolean – Boolean (true) if the solution is running in the developer, (false) otherwise
Also see
External links
Sample
var flag = application.isInDeveloper();
isLastPrintPreviewPrinted
()
Check if the last printpreview did print.
Since
Replace with version info
Parameters
Returns
Boolean – Boolean (true) is the last print preview did print, (false) otherwise
Also see
External links
Sample
//attached this method to onShow on the form being shown after printpreview //set a global called scopes.globals.showPrintPreview to 1 in the onPrintPreview method if (scopes.globals.showPrintPreview == 1) { scopes.globals.showPrintPreview = 0;//clear for next time if (application.isLastPrintPreviewPrinted()) { plugins.dialogs.showInfoDialog('Alert', 'There is printed in printpreview', 'OK') } }
void
output
(msg)
Output something on the out stream. (if running in debugger view output console tab)
Since
Replace with version info
Parameters
{Object} msg – Object to send to output stream
Returns
void
Also see
External links
Sample
// log level is used to determine how/if to log in servoy_log.txt; for smart client java out and err streams are used application.output('my very important trace msg');// default log level: info
void
output
(msg, level)
Output something on the out stream. (if running in debugger view output console tab)
Since
Replace with version info
Returns
void
Also see
External links
Sample
// log level is used to determine how/if to log in servoy_log.txt; for smart client java out and err streams are used application.output('my very important msg',LOGGINGLEVEL.ERROR);// log level: error
void
overrideStyle
(originalStyleName, newStyleName)
Overrides one style (defined in in a form) with another.
Since
Replace with version info
Returns
void
Also see
External links
Sample
//This function will only have effect on forms not yet created, so solution onLoad is the best place to override' //For example overriding the use of default/designed style anywhere in the solution from 'mystyle' to 'mystyle_mac' application.overrideStyle('mystyle','mystyle_mace')//in this case both styles should have about the same classes
void
playSound
(url)
Play a sound (AU file, an AIFF file, a WAV file, and a MIDI file).
Since
Replace with version info
Parameters
{String} url – URL of the sound file
Returns
void
Also see
External links
Sample
application.playSound('media:///click.wav');
putClientProperty
(name, value)
Sets a UI property.
Since
Replace with version info
Returns
Boolean – Boolean (true) if the client property was set with the new value
Also see
External links
Sample
//Only use this function from the solution on open method! //In smart client, use this to set javax.swing.UIDefaults properties. application.putClientProperty('ToolTip.hideAccelerator', true) //To change the comboboxes selection background color, do this: application.putClientProperty('ComboBox.selectionBackground', new Packages.javax.swing.plaf.ColorUIResource(java.awt.Color.RED)) //In web client, use this to change the template directory. //To change the default dir of templates/default to templates/green_skin, do this: application.putClientProperty('templates.dir','green_skin');
void
redo
()
Redo last action (if possible).
Since
Replace with version info
Parameters
Returns
void
Also see
External links
Sample
application.redo();
void
removeAllClientInfo
()
Removes all names given to the client via the admin page.
Since
Replace with version info
Parameters
Returns
void
Also see
External links
Sample
application.removeAllClientInfo();
removeClientInfo
(info)
Removes a string of client information which is stored on the server and
previously was added using the application.addClientInfo('client info')
This function can be called more than once, if you want to delete multiple
lines of client information.
Since
Replace with version info
Parameters
{String} info – A line of text to be removed from the client information
on behalf of the running Servoy client.
Returns
Boolean – boolean indicator if info was removed successfully
Also see
External links
Sample
var removed = application.removeClientInfo('SaaS company name');
void
setClipboardContent
(string)
Sets a string object in the clipboard.
Since
Replace with version info
Parameters
{Object} string – New content of the clipboard
Returns
void
Also see
External links
Sample
application.setClipboardContent('test');
void
setNumpadEnterAsFocusNextEnabled
(enabled)
Set if numpad enter should behave like focus next.
Since
Replace with version info
Parameters
{Boolean} enabled – Boolean (true) if numpad enter should behave like focus next
Returns
void
Also see
External links
Sample
application.setNumpadEnterAsFocusNextEnabled(true);
void
setStatusText
(text)
Set the status area value.
Since
Replace with version info
Parameters
{String} text – New status text
Returns
void
Also see
External links
Sample
application.setStatusText('Your status text');
void
setStatusText
(text, tooltip)
Set the status area value.
Since
Replace with version info
Returns
void
Also see
External links
Sample
application.setStatusText('Your status text','Your status tooltip text');
void
setToolbarVisible
(name, visible)
Make a toolbar visible or invisible.
Since
Replace with version info
Returns
void
Also see
External links
Sample
//example: hide the text toolbar application.setToolbarVisible('text',false);
void
setUserProperty
(name, value)
Set a persistent user property.
Since
Replace with version info
Returns
void
Also see
External links
Sample
application.setUserProperty('showOrders','1');
void
setValueListItems
(name, dataset)
Fill a custom type valuelist with values from array(s) or dataset.
Since
Replace with version info
Returns
void
Also see
External links
Sample
//set display values (return values will be same as display values) application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3')); //set display values and return values (which are stored in dataprovider) //application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array(10000,10010,10456)); //set display values and return values converted to numbers //application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array('10000','10010', '10456'), true); //do query and fill valuelist (see databaseManager for full details of queries/dataset) //var query = 'select display_value,optional_real_value from test_table'; //var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()), query, null, 25); //application.setValueListItems('my_en_types',dataset);
void
setValueListItems
(name, dataset, autoconvert)
Fill a custom type valuelist with values from array(s) or dataset.
Since
Replace with version info
Returns
void
Also see
External links
Sample
//set display values (return values will be same as display values) application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3')); //set display values and return values (which are stored in dataprovider) //application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array(10000,10010,10456)); //set display values and return values converted to numbers //application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array('10000','10010', '10456'), true); //do query and fill valuelist (see databaseManager for full details of queries/dataset) //var query = 'select display_value,optional_real_value from test_table'; //var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()), query, null, 25); //application.setValueListItems('my_en_types',dataset);
void
setValueListItems
(name, displayValues)
Fill a custom type valuelist with values from array(s) or dataset.
Since
Replace with version info
Returns
void
Also see
External links
Sample
//set display values (return values will be same as display values) application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3')); //set display values and return values (which are stored in dataprovider) //application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array(10000,10010,10456)); //set display values and return values converted to numbers //application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array('10000','10010', '10456'), true); //do query and fill valuelist (see databaseManager for full details of queries/dataset) //var query = 'select display_value,optional_real_value from test_table'; //var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()), query, null, 25); //application.setValueListItems('my_en_types',dataset);
void
setValueListItems
(name, displayValues, autoconvert)
Fill a custom type valuelist with values from array(s) or dataset.
Since
Replace with version info
Returns
void
Also see
External links
Sample
//set display values (return values will be same as display values) application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3')); //set display values and return values (which are stored in dataprovider) //application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array(10000,10010,10456)); //set display values and return values converted to numbers //application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array('10000','10010', '10456'), true); //do query and fill valuelist (see databaseManager for full details of queries/dataset) //var query = 'select display_value,optional_real_value from test_table'; //var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()), query, null, 25); //application.setValueListItems('my_en_types',dataset);
void
setValueListItems
(name, displayValues, realValues)
Fill a custom type valuelist with values from array(s) or dataset.
Since
Replace with version info
Returns
void
Also see
External links
Sample
//set display values (return values will be same as display values) application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3')); //set display values and return values (which are stored in dataprovider) //application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array(10000,10010,10456)); //set display values and return values converted to numbers //application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array('10000','10010', '10456'), true); //do query and fill valuelist (see databaseManager for full details of queries/dataset) //var query = 'select display_value,optional_real_value from test_table'; //var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()), query, null, 25); //application.setValueListItems('my_en_types',dataset);
void
setValueListItems
(name, displayValues, realValues, autoconvert)
Fill a custom type valuelist with values from array(s) or dataset.
Since
Replace with version info
Returns
void
Also see
External links
Sample
//set display values (return values will be same as display values) application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3')); //set display values and return values (which are stored in dataprovider) //application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array(10000,10010,10456)); //set display values and return values converted to numbers //application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array('10000','10010', '10456'), true); //do query and fill valuelist (see databaseManager for full details of queries/dataset) //var query = 'select display_value,optional_real_value from test_table'; //var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()), query, null, 25); //application.setValueListItems('my_en_types',dataset);
showCalendar
()
Show the calendar, returns selected date or null if canceled. Initial value and date format can be also specified.
Since
Replace with version info
Parameters
Returns
Date – Selected date or null if canceled
Also see
External links
Sample
var selectedDate = application.showCalendar();
showCalendar
(dateFormat)
Show the calendar, returns selected date or null if canceled. Initial value and date format can be also specified.
Since
Replace with version info
Parameters
{String} dateFormat – Date format
Returns
Date – Selected date or null if canceled
Also see
External links
Sample
var selectedDate = application.showCalendar();
showCalendar
(selectedDate)
Show the calendar, returns selected date or null if canceled. Initial value and date format can be also specified.
Since
Replace with version info
Parameters
{Date} selectedDate – Default selected date
Returns
Date – Selected date or null if canceled
Also see
External links
Sample
var selectedDate = application.showCalendar();
showCalendar
(selectedDate, dateFormat)
Show the calendar, returns selected date or null if canceled. Initial value and date format can be also specified.
Since
Replace with version info
Returns
Date – Selected date or null if canceled
Also see
External links
Sample
var selectedDate = application.showCalendar();
showColorChooser
()
Show the colorChooser. Returned value is in format #RRGGBB or null if canceled.
Since
Replace with version info
Parameters
Returns
String – selected color or null if canceled
Also see
External links
Sample
var selectedColor = application.showColorChooser();
showColorChooser
(colorString)
Show the colorChooser. Returned value is in format #RRGGBB or null if canceled.
Since
Replace with version info
Parameters
{String} colorString – Default color
Returns
String – selected color or null if canceled
Also see
External links
Sample
var selectedColor = application.showColorChooser();
showFontChooser
()
Show the font chooser dialog. Returns the selected font. Can specify a default font.
Since
Replace with version info
Parameters
Returns
String – selected font
Also see
External links
Sample
var selectedFont = application.showFontChooser(); elements.myfield.font = selectedFont
showFontChooser
(defaultFont)
Show the font chooser dialog. Returns the selected font. Can specify a default font.
Since
Replace with version info
Parameters
{String} defaultFont – Default font
Returns
String – selected font
Also see
External links
Sample
var selectedFont = application.showFontChooser(); elements.myfield.font = selectedFont
void
showForm
(form)
Show the form specified by the parameter, that can be a name (is case sensitive!) or a form object.
Since
Replace with version info
Parameters
{Object} form – Form object or name
Returns
void
Also see
External links
Sample
application.showForm('MyForm');
showI18NDialog
()
Opens the i18n dialog so users can change translations. Returns the key selected by the user (not it's translation) or null if cancel is pressed. Optional parameters specify the initial selections in the dialog.
Since
Replace with version info
Parameters
Returns
String – selected I18N key or null if cancel is pressed
Also see
External links
Sample
application.showI18NDialog("servoy.button.close", "en");
showI18NDialog
(keyToSelect)
Opens the i18n dialog so users can change translations. Returns the key selected by the user (not it's translation) or null if cancel is pressed. Optional parameters specify the initial selections in the dialog.
Since
Replace with version info
Parameters
{String} keyToSelect – Default selected key
Returns
String – selected I18N key or null if cancel is pressed
Also see
External links
Sample
application.showI18NDialog("servoy.button.close", "en");
showI18NDialog
(keyToSelect, languageToSelect)
Opens the i18n dialog so users can change translations. Returns the key selected by the user (not it's translation) or null if cancel is pressed. Optional parameters specify the initial selections in the dialog.
Since
Replace with version info
Returns
String – selected I18N key or null if cancel is pressed
Also see
External links
Sample
application.showI18NDialog("servoy.button.close", "en");
showURL
(url)
Shows an URL in a browser.
Since
Replace with version info
Parameters
{String} url – URL to show
Returns
Boolean – Boolean (true) if URL was shown
Also see
External links
Sample
application.showURL('http://www.example.com'); //webclient specific additional parameters... //2nd parameter: target frame or named dialog/window, so its possible to control in which (internal) frame or dialog the url is loaded, '_self' is current window,'_blank' is new dialog, '_top' is main window //3rd parameter: dialog options used when a dialog is specified, example: 'height=200,width=400,status=yes,toolbar=no,menubar=no,location=no' //3th or 4th parameter: a timeout in seconds when the url should be shown, immediantly/0 is default'
showURL
(url, webclientTarget)
Shows an URL in a browser.
Since
Replace with version info
Returns
Boolean – Boolean (true) if URL was shown
Also see
External links
Sample
application.showURL('http://www.example.com'); //webclient specific additional parameters... //2nd parameter: target frame or named dialog/window, so its possible to control in which (internal) frame or dialog the url is loaded, '_self' is current window,'_blank' is new dialog, '_top' is main window //3rd parameter: dialog options used when a dialog is specified, example: 'height=200,width=400,status=yes,toolbar=no,menubar=no,location=no' //3th or 4th parameter: a timeout in seconds when the url should be shown, immediantly/0 is default'
showURL
(url, webclientTarget, timeout)
Shows an URL in a browser.
Since
Replace with version info
Returns
Boolean – Boolean (true) if URL was shown
Also see
External links
Sample
application.showURL('http://www.example.com'); //webclient specific additional parameters... //2nd parameter: target frame or named dialog/window, so its possible to control in which (internal) frame or dialog the url is loaded, '_self' is current window,'_blank' is new dialog, '_top' is main window //3rd parameter: dialog options used when a dialog is specified, example: 'height=200,width=400,status=yes,toolbar=no,menubar=no,location=no' //3th or 4th parameter: a timeout in seconds when the url should be shown, immediantly/0 is default'
showURL
(url, webclientTarget, webclientTargetOptions)
Shows an URL in a browser.
Since
Replace with version info
Parameters
Returns
Boolean – Boolean (true) if URL was shown
Also see
External links
Sample
application.showURL('http://www.example.com'); //webclient specific additional parameters... //2nd parameter: target frame or named dialog/window, so its possible to control in which (internal) frame or dialog the url is loaded, '_self' is current window,'_blank' is new dialog, '_top' is main window //3rd parameter: dialog options used when a dialog is specified, example: 'height=200,width=400,status=yes,toolbar=no,menubar=no,location=no' //3th or 4th parameter: a timeout in seconds when the url should be shown, immediantly/0 is default'
showURL
(url, webclientTarget, webclientTargetOptions, timeout)
Shows an URL in a browser.
Since
Replace with version info
Parameters
{String} url – URL to show
{String} webclientTarget – Target frame or named dialog/window
{String} webclientTargetOptions – Dialog options used when a dialog is specified / a timeout in seconds when the url should be shown
{Number} timeout – A timeout in seconds when the url should be shown
Returns
Boolean – Boolean (true) if URL was shown
Also see
External links
Sample
application.showURL('http://www.example.com'); //webclient specific additional parameters... //2nd parameter: target frame or named dialog/window, so its possible to control in which (internal) frame or dialog the url is loaded, '_self' is current window,'_blank' is new dialog, '_top' is main window //3rd parameter: dialog options used when a dialog is specified, example: 'height=200,width=400,status=yes,toolbar=no,menubar=no,location=no' //3th or 4th parameter: a timeout in seconds when the url should be shown, immediantly/0 is default'
void
sleep
(ms)
Sleep for specified time (in milliseconds).
Since
Replace with version info
Parameters
{Number} ms – Sleep time in milliseconds
Returns
void
Also see
External links
Sample
//Sleep for 3 seconds application.sleep(3000);
void
undo
()
Undo last action (if possible).
Since
Replace with version info
Parameters
Returns
void
Also see
External links
Sample
application.undo();
void
updateUI
()
Updates the UI (painting). If in a script an element changed and the script continues doing
things, you can give an number in ms how long this can take.
Since
Replace with version info
Parameters
Returns
void
Also see
External links
Sample
application.updateUI(500); //continue doing things
void
updateUI
(milliseconds)
Updates the UI (painting). If in a script an element changed and the script continues doing
things, you can give an number in ms how long this can take.
Since
Replace with version info
Parameters
{Number} milliseconds – How long the update should take in milliseconds
Returns
void
Also see
External links
Sample
application.updateUI(500); //continue doing things