once:radix open source downloads | once:radix open source documentation
once:technologies
  • Home
  • Software
  • Services
  • News
  • Testimonials
  • Contact
  • Technical Notes
 

once:radix Documentation

  • once:radix
    • Overview
    • Getting started
    • Fundamentals
    • oADMIN
    • oCLI
    • oED
    • Database
    • Scripting
    • Models
    • Directories
    • Technical Notes

oED script commands

  • Editing
  • Element Control
  • Flow Control
  • Gantt Chart
  • Help
  • Lists
  • Login Management
  • Messages
  • Modes
  • Navigation
  • Records
  • Security
  • Sort Find Print
  • Text
  • Thumbnails
  • Variables
  • Windows
  • WWW

Editing

clear("fieldId")

Description: Clears the contents of the specified field.
Note, to submit the change to the database, the block must be in Edit mode.
Example: if (getMode () == "Edit")
{
   clear("txtClientName");
   enterBrowseMode ();
}
else
   message("To clear a database field, Edit mode must be active.");

 Back to Top

copy("fieldId")

Description: Copies the contents of the specified field and stores it in the clipboard.
Example: copy("txtClientName");
message("Client name (\"" + getElement("txtClientName") + "\" is in the client name field and the clipboard. Paste it into another application to check for yourself.");

 Back to Top

cut("fieldId")

Description: Cuts the contents of the specified field and stores it in the clipboard.
Example: cut("txtClientName");
message("The client name is now only in the clipboard. Paste it into another application to check for yourself.");

 Back to Top

paste("fieldId")

Description: Pastes the contents of the clipboard into the specified field.
Example: paste("txtClientName");
message("The contents of the clipboard is now in the client name field.");

 Back to Top

Element Control

displayElement("elementId", isDisplayed)

Description: Hide/show the selected element (e.g. a button, field, label, graphic, etc.). The element is referred to by its elementid. The visibility status is set by the isDisplayed boolean variable (TRUE = visible, FALSE = hidden.).
The example below combines this function with the isHidden function to toggle the selected element. That is: If it is TRUE that the element is hidden, it is passed to the isDisplayed parameter where the object switches to become visible. If executed a second time, the reverse is performed.
Example: displayElement("txtClientName", isHidden("txtClientName"));
 Back to Top

displayRowElement("subblockId", "elementId", isDisplayed[, row])

Description:

Hide/show the selected element within a sub-block row (e.g. a button, field, label, graphic, etc.). The element is referred to by its subblockid and scriptid. The visible status is set by the isDisplayed boolean variable (TRUE = visible, FALSE = hidden). The optional variable (row) is used to specify the subblock record that is affected. If nothing is specified it uses the currently selected row

The example below combines this function with the isHidden function to toggle the selected element. It performs a loop (for row = 1 to rowcount) to step through all records in the subblock subComponent. It combines the displayRowElement and isRowElementHidden functions to toggle txtComponentName between visible and hidden.

Example: rowCount = totalSubblockRecords("subblock32");
for(index = 1; index <= rowCount; index++)
  displayRowElement("subblock32", "commvalue",
    isRowElementVisible("subblock32","commvalue"),index);
 Back to Top

editAsArea("elementId"[, "returnToScript"[, "returnToScriptCancel"[, "readOnly"]]])

Description: When activated (Browse or Edit mode only), an Area palette opens to display the contents of a field (elementId) to be edited. The function allows Save and/or Cancel buttons to be bound to individual scripts to be performed on exit. The readOnly option disables the Edit button, if TRUE, allowing data to be displayed in the Area palette but preventing it from being changed. The default setting is FALSE.
editAsArea
Example: editAsArea("txtJobDetails", "textEntered", "entryCancelled");
 Back to Top

fieldIndex("elementId", "metamodelDotRelationship", "modelDotAlias")

Description: Display a floating palette that lists each unique entry in the field (elementId) of the specified table (modelDotAlias) within the specified database Relationship (metamodelDotRelationship).
Example: if(getMode() != "Edit")
   enterEditMode();
if(getMode() == "Edit")
   fieldIndex("txtClientName", "contacts.person", "contacts_person.First_Name");
else
   message("Unable to unlock record. Script cannot run.");
 Back to Top

focusElement("elementId")

Description: Apply focus to a field, button, radio button, checkbox, or other element, specified by its elementId. This is equivalent to clicking the mouse button over the element.
Focus can be manually applied by holding the mouse button down over an element, then moving the cursor away before releasing the mouse button.
When focus is applied to some elements (such as buttons), they can be activated by pressing the space bar. e.g. Apply focus to a checkbox, then press the space bar. Each time it is pressed, the next record in the found set is displayed.
Example: focusElement("txtClientName");
 Back to Top

focusRowElement("subblockId", "elementId"[, row])

Description: Apply focus to a field, button, radio button, checkbox, or other element, specified by its elementId in a sub-block record, specified by its subblockId and row (optional). This is equivalent to clicking the mouse button over the element.
Focus can be manually applied by holding the mouse button down over an element, then moving the cursor away before releasing the mouse button.
When focus is applied to some elements (such as buttons), they can be activated by pressing the space bar. e.g. Apply focus to a checkbox, then press the space bar. Each time it is pressed, the next record in the found set is displayed.
Example: focusRowElement("subComponent", "txtComponentName", 1);
 Back to Top

getActiveElementId()

Description: Returns the name of the active field, button, radio button, checkbox, or other element, specified by its elementId. That is, the element to which focus has been applied. (See also focusElement and focusRowElement.)
The example below displays a message stating the elementId of the active element such as:
"The active element is checkbox2."
Example: message("The active element is " + getActiveElementId() + ".");
 Back to Top

getElement("elementId")

Description: Get the contents of the field specified by its elementId. The example below appends the text entered in the input window into the specified field.
In the example below, the screen must be in Edit mode prior to executing the setElement command and the changes must be submitted for the database to be updated.
Example: setElement("txtClientName", getElement("txtClientName") + input("Enter a string, any string, and watch as the amazing concatenator appends it to a field on screen!", ""), true);
 Back to Top

getElementAsDate("elementId")

Description: Get the contents of the field specified by its elementId, returning the result in date format.
The example below retrieves the contents of the date started and date completed fields that are stored in datetime format (in seconds), then converts the difference into a number of days.
Example: message("The project was completed " + ((getElementAsDate("txtDateCompleted") - getElementAsDate("txtDateCreated")) / (60 * 60 * 24)) + " days after it was created.");
 Back to Top

getElementAsNumber("elementId")

Description: Get the contents of the field specified by its elementId, returning the result in numerical format.
The example below retrieves the numerical content of the specified field. If the field contained "ASK 2342343 Q", it would return the message:
The Job number is: 2342343
Example: message("The Job number is: " + getElementAsNumber("txtJobNumber"));
 Back to Top

getEventObject()

Description: Returns the standard browser event object from the Document Object Model (DOM) that called the script which executed the command. This could be used, for example, to identify what event executed the script and what element was involved.
Example: message("You used the event " + getEventObject() + " to call this function.");
 Back to Top

getEventScriptId()

Description: This command can only be used when a block/subblock fires on an onSubmit event. It returns the scriptId of the block or subblock that was submitted.
Example: message("The container that's currently being submitted is:\n" + getEventScriptId());
return;
 Back to Top

getLastShownSubblockRow()

Description: This statement returns the row number of the last sub-block displayed. The example script below returned the message:
getLastShownSubblockRow1
when this sub-block was displayed:
getLastShownSubblockRow2
Example: var lastRow;
lastRow = getLastShownSubblockRow();
message("Last time you browsed a subblock, there " + (lastRow != 1 ? "were" : "was") + " " + getLastShownSubblockRow() + " row" + (lastRow != 1 ? "s" : "") + " in it (including the new row placeholder).");
return;
 Back to Top

getListIndex("scriptId")

Description: Returns the index number of an item selected from the list index of the field specified by its scriptid.
Example: message("You've selected item #" + (getListIndex("drpFruit") + 1));
 Back to Top

getObject("scriptId")

Description: Returns the parameters of a screen element in a named array format as defined in the Document Object Model (DOM). In the example below, if the object exists and has a CSS style assigned to it, the border is set at random to: red or blue at a width of two or four pixels, in solid or dotted format. For example, if the element was a text field, in Edit mode it might appear as:
getObject
Example: var activeObject;
activeObject = getObject(getActiveElementId());
if(activeObject && activeObject.style)
{
   activeObject.style.borderColor = Math.random() >= 0.5 ? "red" : "blue";
   activeObject.style.borderWidth = Math.random() >= 0.5 ? "2px" : "4px";
   activeObject.style.borderStyle = Math.random() >= 0.5 ? "solid" : "dotted";
}
else
   message("No active object, or active object does not support CSS styles.");
 Back to Top

getRowElement("subblockId", "elementId"[, row])

Description: Get the contents of the field, specified by its elementid in a sub-block record, specified by its subblockId and row (optional), returning the result as a string, or in boolean format if the element is a checkbox.
The example below starts at the first record in subblock31 and steps through until it has reached the last record in the subblock. It displays the contents of ownerorganisation12 for each record.
Example: rowCount = totalSubblockRecords("subblock31"); for(index = 1; index <= rowCount; index++)    message("Owner Organisation is " + getRowElement("subblock31", "ownerorganisation12", index));
 Back to Top

getRowElementAsDate("subblockId", "elementId"[, row])

Description: Get the contents of the field, specified by its elementid in a sub-block record, specified by its subblockId and row (optional), returning the result in date format.
The example below retrieves the contents of the date started and date completed fields that are stored in datetime format (in seconds), then converts the difference into a number of days. This is performed for the currently-selected subblock record. If a record is selected, the TRY block statement is performed. Otherwise, an error is thrown that causes the CATCH block to be executed.
Example: try
{
   message(((getRowElementAsDate("subComponent", "txtComponentDateCompleted") - getRowElementAsDate("subComponent", "txtComponentDateCreated")) / (60 * 60 * 24)) + " day(s) have elapsed between the creation and completion dates.");
}
catch(except)
{
   message("Select a subblock row first.");
}
 Back to Top

getRowElementAsNumber("subblockId", "elementId"[, row])

Description: Get the contents of the element, specified by its elementid in a sub-block record, specified by its subblockId and row (optional), returning the result in number format.
The example below retrieves the sum of the numerical content of the specified field for all sub-block records. The for loop starts from the first sub-block record, stepping through each record in turn until it reaches the last record. It shows how to combine getRowElementAsNumber with the totalSubblockRecords command to step through a set of records in a sub-block record.
Example: var index;
var rowCount;
var totalCost;
rowCount = totalSubblockRecords("subComponent");
totalCost = 0;
for(index = 1; index <= rowCount; index++)
   totalCost += getRowElementAsNumber("subComponent", "txtCost", index);
message("The total cost of the " + rowCount + " components in this job is: " + totalCost);
 Back to Top

getRowObject("subblockId", "fieldId"[, row])

Description: Get the contents of the element, specified by its elementid in a sub-block record, specified by its subblockId and row (optional). If the row is not specified, apply focus by clicking on a record before executing this command.
The example below sets the background colour of the active element (txtComponentName) in the current row to red if the field is not empty. This is performed for the currently-selected record in the subblock: subComponent. If the object (txtComponentName) is active, the TRY block statement is performed. Otherwise, an error is thrown that causes the CATCH block to be executed.
Example: var activeObject;
try
{
   activeObject = getRowObject("subComponent", "txtComponentName");
}
catch(except)
{
   activeObject = null;
}
if(activeObject && activeObject.style)
   activeObject.style.backgroundColor = "#ff0000";
 Back to Top

goToElement("scriptId")

Description: This command applies focus to an element, specified its scriptId.
In the example below, the specified element (projectname4) is selected if the screen is in Find or Edit mode.
Example: if (getMode () == "Find" || getMode () == "Edit")
   goToElement ("projectname4")
 Back to Top

goToNextField()

Description: This command is equivalent to clicking the Tab key. It moves focus to the next element on screen, as specified by its Tab order (set in the Properties palette). If no element was selected before executing this instruction, focus is applied to the element with the lowest Tab order number. If the element with the highest Tab order number is active, this command would move focus to the lowest Tab order number. Thus, all elements with Tab order set can be stepped through in a sequence specified by the screen designer.
In the example below, the next element in the specified Tab order is selected if the screen is in Edit mode.
Example: if (getMode () == "Edit")
   goToNextField ();
return;
 Back to Top

goToPreviousField()

Description: This command is equivalent to clicking the Shift-Tab keys. It moves focus to the previous element on screen, as specified by its Tab order (set in the Properties palette). If no element was selected before executing this instruction, focus is applied to the element with the highest Tab order number. If the element with the lowest Tab order number is active, this command would move focus to the highest Tab order number. Thus, all elements with Tab order set can be stepped back through in a sequence specified by the screen designer.
Example: if (getMode () == "Edit")
   goToPreviousField ();
 Back to Top

isVisible("scriptId")

Description: Returns TRUE if the field is visible or FALSE if it is hidden. The field is specified by its elementid in a sub-block record. The example below combines this function with displayElement to toggle the selected element.
Example: displayElement("txtClientName", isHidden("txtClientName"));
 Back to Top

IsRowElementVisible("subblockId", "elementId"[, row])

Description: Returns TRUE if the field in a sub-block row is visible or FALSE if it is hidden. The field is specified by its elementid in a sub-block record, specified by its subblockId and row (optional).
Example: var undefined;
displayRowElement("subComponent", "txtComponentName", !isRowElementVisible("subComponent", "txtComponentName", getMode() == "Find" ? 0 : undefined), getMode() == "Find" ? 0 : undefined);
 Back to Top

setElement("elementId", "value"[, "triggerChange"])

Description: Set the element (e.g. label, field, radio button or check box) identified by its elementId to the specified value. The optional triggerChange parameter is a boolean value. If set to true, an onChange event fires when the element is set.
In the example below, a messages is displayed prompting the user to select a person's name. Based on the choice, that person's full name is entered into field0.
Example: switch(customDialog("Select Client", "Which client do you want to assign to this job?", "Hank", "Tony", "Boadicea"))
{
   case 1:
      setElement("field0", "Mr Hank Jones");
      break;
   case 2:
      setElement("field0", "Mr Tony Jones");
      break;
   case 3:
   default:
      setElement("field0", "Ms Boadicea Basher");
      break;
}
 Back to Top

setMenuSource("menuScriptId", "metamodelDotRelationship", "modelDotAlias")

Description: Links a menu to the database. The menu is identified in scripts by its menuScriptId. The database is referenced by it relationship (metamodelDotRelationship) and the table by the model and field alias (modelDotAlias).
Example: setMenuSource("drpFruit", "contacts.person", "contacts_person.Surname");
 Back to Top

setReadOnly("elementId"[, isReadOnly])

Description: Sets the write status of the element (e.g. field, button or check box) or Object identified by its scriptIdOrObject. The boolean condition (TRUE or FALSE) is defined by the second parameter (isReadOnly). If isReadOnly is TRUE or not specified, the element or object is set to read only. If isReadOnly is FALSE, the element or object is set to allow its contents to be edited.
Example: if(confirm("Lock the Created By field?") == true)
   setReadOnly("txtCreatedBy", true);
 Back to Top

setRowElement("subblockId", "elementId", "value", [row, [triggerChange]])

Description: Set the element (e.g. label, field, button, radio button or check box) on the specified row of a subblock, identified by its elementId, to the specified value. The optional triggerChange parameter is a boolean value. If set to true, an onChange event fires when the element is set.
In the example below, a messages is displayed prompting the user to select a person's name for the currently-selected record (as no row is specified). Based on the choice, that person's full name is entered into field0.
Example: switch(customDialog("Select Client", "Which client do you want to assign to this job?", "Hank", "Tony", "Boadicea"))
{
  case 1:
    setRowElement("subblock32", "commvalue",
      "Mr Hank Jones",currentSubblockRecord ("subblock32"));
  break;
  case 2:
    setRowElement ("subblock32","commvalue",
      "Mr Tony Jones",currentSubblockRecord ("subblock32"));
     break;
  case 3:
  default:
     setRowElement( "subblock32","commvalue",
      "Ms Boadicea Basher", currentSubblockRecord ("subblock32") );
     break;
}
 Back to Top

subblockEditAsArea("subblockId", [row,] "elementId", "returnToScript", "returnToScriptCancel", [readOnly])

Description: When activated, an Area palette opens to display the contents of a field or other element (elementId) to be edited in the row of subblockId. The function allows Save and/or Cancel buttons to be bound to individual scripts to be performed on exit. The readOnly option disables the Edit button, if TRUE, allowing data to be displayed in the Area palette but preventing it from being changed. The default setting is FALSE.
subblockEditAsArea
Example: subblockEditAsArea("subblock23", 1, "firstname12", "scriptOK()", "scriptCancel()", false);
 Back to Top

Flow Control

(condition) ? executeIfTrue : executeIfFalse

Description: If a condition evaluates to true, the executeIfTrue statement is executed. Otherwise, the executeIfFalse statement is performed. This is a shorthand (in line) equivalent of the IF statement.
Example: var index, results = "";
for(index = 1; index <= 10; index++)
   results += index + " is " + ((index % 2) ? "odd" : "even") + "\n";
   message("Here are the results:\n\n" + results);
 Back to Top

break

Description: Stops execution of a while loop, for loop or switch statement, continuing the script at the next statement after the enclosing block.
Example: var index, manufacturer;
var manufacturerLength;
manufacturer = ["Ford", "Holden", "Mitsubishi", "Hyundai", "Subaru"];
manufacturerLength = manufacturer.length;
for(index = 0; index < manufacturerLength; index++)
   if(manufacturer[index] == "Holden")
      break;
message((index < manufacturerLength - 1) ? ("The manufacturer after Holden is: " + manufacturer[index + 1]) : "There is no manufacturer after Holden.");
 Back to Top

cancelEvent()

Description: Cancels any one of the following events:
  • Delete
  • Find
  • Submit
  • Subblock submit
If the script is attached to the onSubmit (Before) event in the example below, the cancelEvent statement could be used to validate that a name has been entered before the record is submitted. This is useful when several fields need to be validated prior to allowing oCLI's inbuilt submit function from executing. (e.g. If the user double clicks the display while in Edit mode.)
Example: if(getElement("txtName") == "")
{
   message("A name is required.");
   cancelEvent();
   focusElement("txtName");
}
 Back to Top

continue

Description: Completes the current loop, ignoring statements below it, forcing the loop to prematurely re-evaluate the condition, and continuing with the next value.
Example: var index, evens = "";
for(index = 1; index <= 10; index++)
   if(index % 2)
      continue;
   evens += index + " \n";
message("Here are the results:\n\n" + evens);
 Back to Top

do {...} while(condition)

Description: Loops while the condition evaluates to TRUE. The test is performed at the end of the loop so the statements within the braces {...} always execute at least once.
Example: var binary = "", decimal = 2322;
do
   binary = (Math.floor(decimal) % 2) + binary;
while((decimal /= 2) >= 1);
message("Binary is: " + binary);
 Back to Top

for(initialisation; condition; increment) {...}

Description: Repeat a loop one or more times. Each time a loop is completed, the loop counter is incremented or decremented, starting from the initial value until the condition is met. The example below would display the following pattern in a message box:
  *
                             *
     *
                        *
        *
                    *
          *
                  *
            *
                *
             *
               *
              *
              *
Example: var pattern = "", index, limit = 100, fill, count;
for(index = 1, count = 0; count < 27; index = limit - (index * 5 / 6), count++)
{
   for(fill = 0; fill < index; fill++)
   pattern += " ";
   pattern += ".\n";
}
message(pattern);
 Back to Top

for(variable in object) {...}

Description: The FOR...IN statement is used to loop through the elements of an array or through the properties of an object. The example below sets up the price of four items in an object then cycles through displaying each of them by name and price in a message window.
Example: var product, groceryStore, store; store = function() {}; store.prototype = {"chewing gum": "$1.00ea", "soft drink": "3.00ea"}; groceryStore = new store(); groceryStore["avacados"] = "$2.99ea"; groceryStore["onions"] = "$3.99kg"; groceryStore["beans"] = "$2.99kg"; for(product in groceryStore)    message("Product " + product + " sells for " + groceryStore[product]);
 Back to Top

if (condition) {...} [[else {...}][else if {...}]]

Description: If the condition is TRUE perform the statements enclosed within the braces {...}. There are two optional additions:
1. else may be appended to cause statements to be executed if the condition is FALSE.
2. else if may be appended to cause an alternate test to be executed if the condition is FALSE.
Example: (if ... else ...)
if (Math.random() >= 0.5)
   message ("Weather is sunny.");
else
   message ("Conditions are overcast.");

(if ... else if ... else ...)
if (Math.random() >= 0.5)
   message ("Weather is sunny.");
else if (Math.random() < 0.3)
   message ("Weather is freezing.");
else
   message ("Conditions are overcast.");
 Back to Top

pause("milliseconds")

Description: Pauses execution of a script for a specified number of milliseconds.
Example: message("Get ready for a big pause!");
pause("5000");
message("That pause lasted five seconds.");
 Back to Top

return [(value)]

Description: This statement is typically used to exit a script before reaching the end of the code. Optionally, it may also return a value to the calling script. These statements may appear any number of times within a script to allow multiple exit points. If there are no values to return, the parentheses may be omitted.
Example: return(getLoginLastName() + ", " + getLoginFirstName());
 Back to Top

scriptname([parameter-1, .. parameter-n])

Description: Scripts are created in the Script Editor (Tools menu). The scriptname is assigned when the script is saved.
The script is called when an assigned event is triggered or when called by another script.
To execute a script within another script, specify its name in the form: scriptname(). These may be empty, or contain comma-separate parameters may be passed to them within the parentheses.
After a script has been called and executed within another script, control returns to the calling script, which then executes its next script statement.
Example: 1. script1 sets up a global variable, then calls script2 to display a message:
script1
   setGlobal("name", "Dean");
   script2();

script2
   var userName = getGlobal("name");
   message (userName);

2. script3 assigns a standard variable using the var statement, then calls script4 to display a message:
script3
   var userName = "Dean";
   script4(userName);

script4
   var userName = arguments[0];
   message (userName);
 Back to Top

switch(condition) {case value-1: break; ... case value-n: break; [default: break;]}

Description: Runs the set of commands under the first CASE statement that matches the CONDITION. If no match is found, default statements may optionally be included as a catch-all.
Example: var brand, clothing = "jeans";
switch(clothing)
{
   case "jumper":
      message("50% off selected item");
      break;
   case "jeans":
      message("20% off selected item");
      break;
   case "playstation":
      message("15% off selected item");
      break;
   default:
      message("10% off selected item");
      break;
}
 Back to Top

try {...} catch(error) {...}

Description: Attempts to perform the commands inside the try {...} block without error. If an error occurs, the rest of the try block is ignored, and the statements in the catch {...} block are executed.
Example: var nothing = null;
try
{
   message(nothing.propertyExample);
}
catch(error)
{
   message("An error occurred when trying to access the properties of nothing. Value was: " + nothing);
}
 Back to Top

while(condition) {...}

Description: The while loop performs a set of instructions zero or more times. The condition is tested on entry. If the test returns a TRUE result, the loop is executed and repeats this process while the specified condition is true. If the test fails, control is transferred to the first statement after the loop.
Example: var binary = "", decimal = 2322;
while((decimal /= 2) >= 1)
binary = (Math.floor(decimal) % 2) + binary;
   message("Binary is: " + binary);
 Back to Top

with(variable) {...}

Description: This statement simplifies object references and makes code more readable. In the example below, two prices for avacados are defined - one as an element of an object and one in a standard variable. The element of the object (groceryStore.avacados) is displayed as the subject of the with statement. The second message is outside of the scope of the with statement, so it prints the standard variable (avacados).
Example: var groceryStore, avacados = "$3.49ea";
groceryStore = new Object();
groceryStore.avacados = "$2.99ea";
with(groceryStore)
   message("Avacados available for: " + avacados);
message("Avacados available for: " + avacados);
 Back to Top

yieldTo("callbackFunction"[, milliseconds, arg1[, ..., argN]])

Description: Evaluates an expression or calls a function after a specified number of milliseconds have elapsed.

miliseconds - A number or numeric string. Default = 1 mS.

arg1, ..., argN - The arguments, if any, passed to the callbackFunction.

This example passes four parameters (121, 232, 324, 999) to the script showTimeoutMessage after a delay of 100 milliseconds.
Example: yieldTo("showTimeoutMessage", 100, 121, 232, 324, 999)
 Back to Top

Gantt Chart

This section of oED has not been implemented. Currently Gantt chart controls are created through direct editing of the XML block files. These script commands will be defined in a future release, once the Gantt Chart palette is available.

getGanttChartDragHeaderKeyValue()
getGanttChartDragIsCopied()
getGanttChartDragSelectedValue("modelDotAlias")
getGanttChartLastClickedColumn("scriptId")
getGanttChartRowCount("scriptId")
getGanttChartRowValue("scriptId", "row")
getGanttChartSelectedColumnValue("scriptId", "modelDotAlias")
getGanttChartSelectedHeaderKey("scriptId")
getGanttChartSelectedRow("scriptId")
getGanttChartSelectedValue("scriptId")
getGanttChartTimeScale("scriptId")
moveGanttChartRowLeft("scriptId")
moveGanttChartRowRight("scriptId")
refreshGanttChart("scriptId")
setGanttChartIgnoreHolidays("scriptId", "ignoreHolidays")
setGanttChartRowByValue("scriptId", "value")
setGanttChartScale("scriptId", "newScale")
sizeGanttChartRowLess("scriptId")
sizeGanttChartRowMore("scriptId")


Help

applicationHelp()

Description: Loads the help application (oHELP) then attempts to open the default help page for the currently displayed screen view (parent block). For example, if the parent block is defined by the server pathname:
...once/application/contacts /person_personal_details.xml
the default help page would be defined by the server pathname:
...once/help/application/contacts /person_personal_details.shtml
Note: To aid readability, underscores (_) appear as spaces when block names are displayed in the browser.
The example below combines the applicationHelp() function with the setHelpPage() and askWithCancel() commands to show how to select either the default or index help page when launching oHELP.
Example: switch(askWithCancel("Do you want to look up the default help page instead?"))
{
   case true:
      setHelpPage("index");
      applicationHelp();
      setHelpPage();
      break;
   case false:
      applicationHelp();
      break;
   case null:
   default:
   break;
}
 Back to Top

help()

Description: Loads the help application (oHELP) then attempts to open the index help page defined by the server pathname:
...once/help/application/contacts /index.shtml
The example below combines the applicationHelp()and Help() functions to show how to select either the default or index help page when launching oHELP.
help
Example: switch(customDialog("Help", "Do you want help for this page or for oCLI?", "Help for This Page", "oCLI Help"))
{
   case 1:
      applicationHelp();
      break;
   case 2:
   default:
      help();
      break;
}
 Back to Top

setHelpPage(["customHelpPage"])

Description: This command sets the name of a custom help page to be loaded by the applicationHelp()command. The pathto the page on the server would be:
../help/application/subdirectory/filename.shtml
Example: setHelpPage("index");
applicationHelp();
 Back to Top

Lists

getLastListSelection ();

Description: This function is used to return the value selected from pull-up lists that are created using the pullUpList and pullUpListWithCustomButton functions. The value is returned from the field specified by the "returnAlias" parameter of the two associated functions.
In the example below, the value is passed through the returnAlias (when an item is chosen in a pull-up list) to the variable selectorType.
Example: var selectorType = getLastListSelection();
message(selectorType)
 Back to Top

pullUpList ("metamodelDotRelationship", "returnAlias",
"onFieldSelectedScript",
"sortByCommaSeparatedList", "sortInAscendingOrderFlag",
"widthInPixels",
"shownModelDotAlias1", "delimeter1",
[... "shownModelDotAliasN", "delimeterN",]
["nullSeparator"
[,"restrictAlias1", "restrictValue1", "isDateRestriction1"
[,..."restrictAliasN", "restrictValueN", "isDateRestrictionN"]]]
[,"disableClearButton"]);

Description: This displays a floating palette that lists each unique entry in the fields (elementId) of the specified tables (modelDotAlias) within the specified database Relationship (metamodelDotRelationship). This function is similar to the Field Index, except that the data comes from a relationship and each line can hold data from many fields, instead of just a single field.
ParameterDescription
metamodelDotRelationshipDefines which relationship to use in the list.
returnAliasSpecifies what data to return (using getLastListSelection).
onFieldSelectedScriptSets the script to run when something is selected from the list.
sortByCommaSeparatedListThis lists the aliases to sort by. sortInAscendingOrderFlag
sortInAscendingOrderFlagIndicates whether the aliases (listed in sortByCommaSeparatedList) should be sorted in ascending order (TRUE) or descending order (FALSE).
widthInPixelsSets the width of the palette.
shownModelDotAliasIndicates which field aliases to use to display in the palette.
delimeterSets the character(s) used to separate fields in each row of the palette.
nullSeparator This must be the keyword NULL. It separates the data that definition, from the restrictions.
restrictAlias Aliases can be used to restrict the data to be displayed.
restrictValueThis sets the value of the restriction. It must be a data type that matches the restrictAlias type.
isDateRestriction This must be true if the restriction is a date, and false for all other data types.
disableClearButtonIf this is true, it will disable the clear button. The clear button will trigger the onFieldSelectedScript and return null to getLastListSelection. The default value is FALSE.
Example: pullUpList ( "contacts.organization_list",
"contacts_organization_list.primary", " setBranch ",
"contacts_organization_list.Org_Code", true, "600",
"contacts_organization_list.Organization", "")
 Back to Top

pullUpListWithCustomButton ("buttonScript", "buttonText",
"metamodelDotRelationship", "returnAlias",
"onFieldSelectedScript",
"sortByCommaSeparatedList", "sortInAscendingOrderFlag",
"widthInPixels",
"shownModelDotAlias1", "delimeter1",
[... "shownModelDotAliasN", "delimeterN",]
["nullSeparator"
[, "restrictAlias1", "restrictValue1", "isDateRestriction1",
[, ... "restrictAliasN", "restrictValueN", "isDateRestrictionN"]]]
[, "disableClearButton"]);

Description: This displays a floating palette that lists each unique entry in the fields (elementId) of the specified tables (modelDotAlias) within the specified database Relationship (metamodelDotRelationship). It is similar to the pullUpList function but allows an additional button to be added to the palette that
ParameterDescription
buttonScriptSpecifies the name of the script to be executed when the custom button is clicked.
buttonTextSpecifies the name to be displayed on the custom button.
metamodelDotRelationshipDefines which relationship to use in the list.
returnAliasSpecifies what data to return (using getLastListSelection).
onFieldSelectedScriptSets the script to run when something is selected from the list.
sortByCommaSeparatedListThis lists the aliases to sort by. sortInAscendingOrderFlag
sortInAscendingOrderFlagIndicates whether the aliases (listed in sortByCommaSeparatedList) should be sorted in ascending order (TRUE) or descending order (FALSE).
widthInPixelsSets the width of the palette.
shownModelDotAliasIndicates which field aliases to use to display in the palette.
delimeterSets the character(s) used to separate fields in each row of the palette.
nullSeparator This must be the keyword NULL. It separates the data that definition, from the restrictions.
restrictAlias Aliases can be used to restrict the data to be displayed.
restrictValueThis sets the value of the restriction. It must be a data type that matches the restrictAlias type.
isDateRestriction This must be true if the restriction is a date, and false for all other data types.
disableClearButtonIf this is true, it will disable the clear button. The clear button will trigger the onFieldSelectedScript and return null to getLastListSelection. The default value is FALSE.
Example: pullUpListWithCustomButton ("newOrg", "New",
"contacts.organization_list",
"contacts_organization_list.primary", "setBranch",
"contacts_organization_list.Org_Code", true, "600",
"contacts_organization_list.Organization", "")
 Back to Top

setPullUpListDistinct ();

Description: This function populates a pullup list with a set of unique entries for the next pullUpList or pullUpListWithCustomButton command. i.e. If a value is repeated in the table(s) from which the list is constructed, only one is shown.
Example: Example setPullUpListDistinct (); pullUpList ( "contacts.organization_list", "contacts_organization_list.primary", " setBranch ", "contacts_organization_list.Org_Code", true, "600", "contacts_organization_list.Organization", "")
 Back to Top

Login Management

getGMT()

Description: Returns the offset from GMT of the time zone selected when the user logged on. e.g.If the time zone is Atlantic Daylight Time, the offset would be -03:00 hours (ADT).
Example: var gmtOffset = getGMT();
message("Your GMT offset is " + ((gmtOffset >= 0) ? "+" : "-") + gmtOffset + " hour" + ((gmtOffset == 1) ? "" : "s") + ".");
return;
 Back to Top

getLicenseInfo()

Description: This command displays the software licence details for the current server. It can assist with debugging of server configuration issues.
The example below displayed these details when connected to a server:

The license information for this installation is:
Hardware ID := 4d4d4a9ead549b934f23970f434e9267
Connected through := org.postgresql.Driver version 8.2
Logged users count := 2
Owner := N/A
License type := Freeware license
Maximal concurrent users count := unlimited
Serial Key := N/A
Uptime := 169075600
Database address := 192.168.111.111
Database version := PostgreSQL 8.1.10 on x86_64-unknown-linux-gnu, compiled by GCC
gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-8)
Database name := radix
Last database backup := Wed Jul 02 12:00:50 EST 2008
Last database vacuum := Wed Jul 02 00:00:09 EST 2008
Operating system := Linux Version 2.6.9-55.0.9.ELsmp
Processor := amd64
Tomcat version := Apache Tomcat/5.5.25
Time zone := Eastern Standard Time (Victoria)
Java version := 1.5.0_12-b04
Java heap size := 478Mb
Java maximum heap size := 910Mb
Java heap free := 241Mb
once:server version := 1.0.0.0
Jasper Reports version := 2.0.1
iText library version := 2.0.4
jFree Chart library version := 1.0.6
Product name := once:radix
Product version := 1
Product database version := 1
Browser version := Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9)
Gecko/2008061004 Firefox/3.0
Example: var info;
var index;
var infoText;
info = getLicenseInfo()
infoText = "";
for(index in info)
   infoText += index + " := " + info[index] + "\n";
message("The license information for this installation is:\n" + infoText);
 Back to Top

getLoginBranch()

Description: Returns the name of the Branch selected when the user logged on.
Example: message("You're part of the " + getLoginBranch() + " branch of the " + getLoginOrganization() + " organisation.");
 Back to Top

getLoginCanUseAdministration()

Description: This function checks the current user's access privileges to determine whether he or she has access rights to launch oADMIN.
Example: message("You currently have access to the following programs:\n" + (getLoginCanUseAdministration() == true ? "oADMIN " : "") + (getLoginCanUseEditor() == true ? "oED " : "") + (getLoginCanUseClient() == true ? "oCLI " : ""));
 Back to Top

getLoginCanUseClient()

Description: This function checks the current user's access privileges to determine whether he or she has access rights to launch oCLI.
Example: message("You currently have access to the following programs:\n" + (getLoginCanUseAdministration() == true ? "oADMIN " : "") + (getLoginCanUseEditor() == true ? "oED " : "") + (getLoginCanUseClient() == true ? "oCLI " : ""));
 Back to Top

getLoginCanUseEditor()

Description: This function checks the current user's access privileges to determine whether he or she has access rights to launch oED.
Example: message("You currently have access to the following programs:\n" + (getLoginCanUseAdministration() == true ? "oADMIN " : "") + (getLoginCanUseEditor() == true ? "oED " : "") + (getLoginCanUseClient() == true ? "oCLI " : ""));
 Back to Top

getLoginDateFormat()

Description: Returns the default date format (e.g. dd/mm/yy or mm/dd/yy) selected when the user logged on.
Example: message("Using your default system date format, today's date would appear as:\n" + formatAsDate((new Date()).getTime() / 1000, getLoginDateFormat()));
 Back to Top

getLoginFirstName()

Description: Returns the first name of the user currently logged on.
Example: message("Hello " + getLoginFirstName() + " " + getLoginLastName() + "!");
 Back to Top

getLoginIsAutoResized()

Description: Returns the status of the "Allow application to resize window." checkbox on the log on screen. This function returns TRUE if the checkbox is set.
Example: message(getLoginIsAutoResized() == true ? "Looks like you like the dynamic look/feel of an auto-resized window." : "I see you're a fixed window kind of guy/gal.");
 Back to Top

getLoginLastName()

Description: Returns the surname of the user currently logged on.
Example: message("Hello " + getLoginFirstName() + " " + getLoginLastName() + "!");
 Back to Top

getLoginLocation()

Description: Returns the Location selected when the user logged on.
Example: ask("Your time zone is currently \"" + getLoginLocation() + "\". Do you want to use this time zone to show your business hours as GMT?");
 Back to Top

getLoginOrganization()

Description: Returns the name of the organization selected when the user logged on.
Example: message("You're part of the " + getLoginBranch() + " branch of the " + getLoginOrganization() + " organisation.");
 Back to Top

getLoginOwnerOrganisation()

Description: once:radix supports multiple owner organisations, sharing a common database, but completely isolated from one another. This allows two or more organisations to share the same server. Each application operates within its own set of blocks and report layouts.
Example: var ownerOrganisation;
ownerOrganisation = getLoginOwnerOrganization();
message("This record " + ((getElement("txtOwnerOrganisation") == ownerOrganisation) ? "belongs" : "doesn't belong") + " to your owner organisation, " + ownerOrganisation + ".");
 Back to Top

getLoginPersonmember()

Description: Returns the contents of the personmember table in an array. The example below shows a typical output display of a user's personmember record.
Your personal membership information is as follows:
fk_staff := 93
Organisation := Plaudits Communicationa
Class := NULL
staff := t
Branch := Office
temp := NULL
Currency := AUD
fk_supplier := NULL
After_Hours_Telephone_Number := NULL
fk_level := 171
Fax_Number := NULL
primary := 27
Telephone_Number := NULL
fk_currency := 6
Mobile_Telephone_Number := NULL
client := t
Owner_Organization := Demonstration Program
fk_person := 26
supplier := f
fk_addressdefault := 138
Contact := Mr Ross Nathan
Preferred_Communications := NULL
Currency_Symbol := $
fk_client := 77
Email_Address := ross@doittwice.net.au
Example: var table;
var info;
var index;
var tableColumnCount;
table = selectRecords("data/contacts_personmember", "primary", "=" + getLoginPersonmember());
info = "";
if(table.length >= 2)
{
   tableColumnCount = table[0].length;
   for(index = 0; index < tableColumnCount; index++)
      info += table[0][index] + " := " + table[1][index] + "\n";
   message("Your personal membership information is as follows:\n" + info);
}
else
   message("Your personal membership record was not found.");
 Back to Top

getLoginSession()

Description: Returns the login session details in an array. The example below shows a typical output display.
Your personal session information is as follows:
fk_dateformat := 1
primary := 2405
fk_timeformat := 1
fk_usersecurity := 2
Local_Date := 1183122235068
fk_personmember := 27
Session_Closed := f
IP := 58.168.235.220
Owner_Organization := Demonstration Program
fk_location := 13
Local_Date_as_Date := 1183158235.06892
SessionKey := fb051d4933ba920f41e91432374678544a502af6
Example: var table;
var info;
var index;
var tableColumnCount;
table = selectRecords("system/security_loginhistory", "SessionKey", "=" + getLoginSession());
info = "";
if(table.length >= 2)
{
   tableColumnCount = table[0].length;
   for(index = 0; index < tableColumnCount; index++)
      info += table[0][index] + " := " + table[1][index] + "\n";
   message("Your personal session information is as follows:\n" + info);
}
else
   message("Your personal session record was not found. Don't panic. The server is storing your record in RAM and hasn't written it to the database.");
 Back to Top

getLoginTimeFormat()

Description: Returns the default date format (e.g. hhhh:MM:ss or hh:MM:ss AM/PM) selected when the user logged on.
The example below would return the message:
Today's date is:
29 Jun 07
Example: message("Today's date is:\n" + formatAsDate((new Date()).getTime() / 1000, getLoginDateFormat()));
 Back to Top

getLoginUsername()

Description: Returns the user name of the currently logged on user.
You are currently authenticated as the user: Hermann.
Example: message("You are currently authenticated as the user: " + getLoginUsername() + ".");
 Back to Top

logout()

Description: Quits the oCLI application and returns the user to the second log on screen.
Example: if(ask("Are you sure you want to quit?") == true)
   logout();
 Back to Top

Messages

confirm("message")

Description: This command displays a message (text), allowing the user to click OK or Cancel. If OK is clicked, this returns a TRUE to the calling function. Clicking Cancel returns a FALSE to the calling function.
In the example below, the user is asked whether to continue with some "very risky process". If the user clicks Cancel, the process stops. If OK is clicked, a message is displayed, advising the user that he or she is a 'daredevil'.
Example: if(confirm("Continue this very risky process?") == true)
   message("You daredevil!");
else
   message("Process terminated.");
 Back to Top

ask("message"[, "windowTitle"])

Description: This function displays a dialog message in a popup window with a windowTitle, prompting the user to make a choice. If Yes is clicked, this returns a TRUE to the calling function. Clicking No returns a FALSE to the calling function.
In the example below, the variable shutter is preset to a global value (shutterSpeed), obtained using the getGlobal function or to 0.2 if shutterSpeed is not set (NULL). When prompted to change the shutter speed, an entry dialog window is displayed if the user clicks Yes. Not that the title of the message has the title: Camera Interface. The new setting is displayed after setting the global variable shutterSpeed.
Example: var shutter;
shutter = getGlobal("shutterSpeed");
if(shutter || shutter == 0); else
   shutter = 0.2;
message("The shutter speed is:\n" + shutter);
if(ask("Do you want to adjust the shutter speed?", "Camera Interface") == true)
   shutter = input("New shutter speed (in seconds):", shutter);
setGlobal("shutterSpeed", shutter);
message("The shutter speed is:\n" + shutter);
 Back to Top

askWithCancel("message"[, "windowTitle"])

Description: This function displays a dialog message in a popup window with a windowTitle, prompting the user to make a choice. If Yes is clicked, this returns a TRUE to the calling function. Clicking No returns a FALSE to the calling function. Clicking Cancel returns a NULL response to the calling function, allowing for three possible choices.
The example below combines askWithCancel() with the setHelpPage() and applicationHelp() commands to show how to select either the default or index help page when launching oHELP.
Example: switch(askWithCancel("Do you want to look up the default help page instead?"))
{
   case true:
      setHelpPage("index");
      applicationHelp();
      setHelpPage();
   break;
   case false:
      applicationHelp();
      break;
   case null:
   default:
      break;
}
 Back to Top

customDialog("windowTitle", "question"[, "button1"[, "button2"[, "button3"]]])

Description: This function allows more flexible dialog boxes to be created that can include a custom window title (windowTitle), question or statement (question), and up to three custom buttons.
In the example below, the following custom dialog would be created:
customDialog
Example: customDialog("What next?", "There's a fork in the path, and the cave continues in two directions from here. You can proceed to either the left or right" + ".", "Go left", "Go right", "Go back");
 Back to Top

input("question", "defaultValue")

Description: Prompts the user with an optional entry in the input screen, then waits for the user to accept the default or enter a new option. If cancel is clicked, it will return null.
Example: var favColour, fabricColours;
fabricColours = "blue, red, orange, pink, yellow".toUpperCase();
favColour = input("What is your favourite colour?", "Blue");
if(fabricColours.indexOf(("" + favColour) .toUpperCase())> -1)
   message("You're in luck! Our designer fabrics are available in that colour.");
else
   message("Sorry. We are out of stock of that colour.");
 Back to Top

message("text")

Description: This function displays the message defined in the text parameter. Line breaks (\n) and tabs (\t) can be included in the string. In the examples below, Script1 displays a simple text message over five lines, separated by four line breaks. Script2 displays the contents of a database field and the length of the field (number of characters).
Example: Script1
message
(
   "Sometimes it can be helpful to\n" +
   "spread a message out onto multiple\n" +
   "lines like this. More examples of\n" +
   "message() are scattered\n" +
   "throughout this list."
);

Script2
message("The Contact is: " + getElement("contact1") + " - " + length(getElement("contact1")) + " characters.");
 Back to Top

Modes

cancelEditMode()

Description: This command switches from Edit mode back to Browse mode without first submitting any changes that have been made to the data in the current record. If any sub-block records are unlocked, they are also locked. This is equivalent to performing the Cancel Edit function .(See context menu.)
Example: if (getMode() == "Edit")
   cancelEditMode ();
 Back to Top

cancelSubblockRowEdit("subblockId", "rowNumber")

Description: This command switches from Edit mode back to Browse mode without first submitting any changes that have been made to the data in the current sub-block record. This is equivalent to performing the Cancel Row Edit function .(See context menu.)
Example: if (isSubblockRowUnlocked ("subblock6", currentSubblockRecord ("subblock6")))
   cancelSubblockRowEdit ("subblock6", currentSubblockRecord ("subblock6"));
 Back to Top

enterBrowseMode()

Description: This command switches from Edit or Find mode to Browse mode after first submitting changes that have been made to the data in the current record. If any sub-block records are unlocked, they are also locked. This is equivalent to performing the Browse Mode function .(See context menu.)
Example: if (getMode () != "Browse")
   enterBrowseMode ();
 Back to Top

enterEditMode()

Description: This command switches from Browse mode to Edit mode in the current record. This is equivalent to performing the Edit Mode function.(See context menu.)
Example: if (getMode () != "Edit")
   enterEditMode ();
 Back to Top

enterFindMode(["rememberLastFind"])

Description: This command switches from Browse or Edit mode to Find mode in the current record. This is equivalent to performing the Find Mode function.(See context menu.)
Example: if (getMode () != "Find")
   enterFindMode (true);
 Back to Top

getMode()

Description: This function returns the current screen mode as a string: Either "Browse", "Edit" or "Find". The example below shows how to use the CASE ... BREAK construct to determine the behavior of the script, depending on the currently-selected mode. Each message statement could be replaced by a series of steps, terminated by a BREAK statement, for each mode.
Example: switch (getMode ())
{
   case "Browse":
      message ("In Browse Mode.");
      break;
   case "Edit":
      message ("In Edit Mode.");
      break;
   case "Find":
      message ("In Find Mode.");
      break;
}
return;
 Back to Top

isSubblockRowUnlocked("subblockId", rowNumber)

Description: This function returns TRUE when the specified row of the subblock is UNLOCKED. If a rowNumber is not specified, the test is performed for the currently-selected subblock row. If no row is selected, the function returns NULL.
Example: if (isSubblockRowUnlocked ("subblock6", 2))
   message ("Unlocked");
else
message ("Locked");
 Back to Top

lockSubblockRow("subblockId", row, alwaysCommit)

Description: Locks specified row in subblock. If alwaysCommit is set to true, it will automatically submit and not ask if the user wants to submit the changes
Example: lockSubblockRow("subblock6", 2, false)
 Back to Top

modeLock(isLocked)

Description: Locks current mode, disable mode switching.
Example: modeLock (true);
 Back to Top

setKioskMode(isEnabled)

Description: If the isEnabled parameter of this command is set to TRUE, the browser display switches to kiosk mode. If set to FALSE, the browser disables kiosk mode.
Example: if(confirm("You are about to switch to full-window mode. Press CTRL+K to display standard toolbars.") == true)
   setKioskMode(true);
 Back to Top

unlockSubblockRow("subblockId", row)

Description: Unlocks specified subblock's row.
Example: lockSubblockRow("subblock6", 2, false);
   if (confirm("Unlock row?") == true)
      unlockSubblockRow("subblock6", 2);
 Back to Top

Navigation

firstRecord()

Description: This command switches to the first record in the current found set. This is equivalent to performing the First function.(See context menu.)
Example: firstRecord ();
return;
 Back to Top

getBlockName()

Description: Returns the name of the block that hosts the script which executes the command.
Example: message("This block is called \"" + getBlockName() + "\"."); return;
 Back to Top

goToLayout("block"[, "find-field", "find-value"[, "sort-field"[, "ascending"[, "waitUntilLoaded"]]]])

Description: This command loads a new layout block. The default setting (goToLayout("block")) is equivalent to right-clicking the mouse, selecting the File... Open... option from the palette, then choosing a block to load. This would not pass any search and sort parameters to the new page.
In the first example below (from the once:fabrik application), the block file (job_details.xml) is loaded from the server (../once/projects). Data are passed to the new block which is used by an on-load event to execute a new script to find, sort and display data associated with the calling page.
The find-field (in this example: projectnumber) specifies the name of the field to search when the new page loads and the find-value specifies the value to search for. It is obtained from the local field (projectcode2).
The sort-field (also projectnumber) specifies the name of the field to sort the found set by when the new page loads. If ascending is set to TRUE (the default value), the found set is sorted in ascending order. In this example, it would sort in descending order.
The waitUntilLoaded option instructs the onLoad script in job_details.xml to wait until the block has loaded completely before executing the onLoad script. The default value for this is also TRUE.
The second example below is a useful function for developers. It is equivalent to typing ctrl-shift-R, or selecting the File... Reopen option from the palette.
Example: Example 1
if (getMode () == "Browse" || getMode () == "Edit")
   goToLayout ("projects/job_details", "projectnumber", getElement ("projectcode2"), "projectnumber", false);

Example 2
goToLayout(getBlockName());
 Back to Top

goToRecord(record)

Description: Moves to the specified record in the found set.
Example: if (getMode () == "Browse")
   goToRecord (6);
return;
 Back to Top

goToSubblockRow("subblockId", rowNumber)

Description: Moves to the record (rowNumber)in the specified subblock.
Example: if (getMode () == "Browse")
   goToSubblockRow ("subblock6", 2);
return;
 Back to Top

isLoadingBlock()

Description: This function allows the calling script from the current block to ascertain whether the next block has finished loading and has begun executing startup scripts (if applicable).
Example: message("oCLI is " + (isLoadingBlock() == false ? "not" : "") + " waiting for blocks/subblocks to load.");
 Back to Top

lastRecord()

Description: This command switches to the last record in the current found set. This is equivalent to performing the Last function.(See context menu.)
Example: lastRecord ();
   return;
 Back to Top

nextRecord()

Description: Displays the next record in the found set (unless the current record is the last one in the found set). This is equivalent to performing the Next function.(See context menu.)
Example: nextRecord ();
   return;
 Back to Top

previousRecord()

Description: Switches to the previous record in the found set (unless the current record is the first one in the found set). This is equivalent to performing the Previous function.(See context menu.)
Example: previousRecord ();
   return;
 Back to Top

Records

clearLastInsertedRecord("elementId")

Description:Erases values in the last inserted row of the specified subblock.
Example:

var totalSubRecords = totalSubblockRecords ("subblock6") + 1;

clearLastInsertedRecord ("subblock6")

unlockSubblockRow ("subblock6", totalSubRecords);

setRowElement ("subblock6", "propositionname6", "Testing clearLastInsertedRecord", totalSubRecords);

lockSubblockRow ("subblock6", totalSubRecords , true)

message (getLastInsertedRecordValue ("projects_proposition.Proposition_Name", "subblock6"));

 Back to Top

currentRecord()

Description:This command returns the record number of the current record. Records are numbered from one to the total number of records in the found set.

If the record number is one greater than the total found count, the current record is a placeholder. That is, a new record is being created in Edit Mode and is yet to be submitted to the database.
Example:

if (currentRecord () == 3)

message ("Record 3");

 Back to Top

currentSubblockRecord ("subblockId")

Description: This command returns the row number of the current subblock record.

Subblock rows may be numbered zero (This is the number of the placeholder in Find mode.) or one to the total number of rows in the subblock (Browse or Edit mode).

There is a third possibility: If the row number is one greater than the total number of rows, the current row is a placeholder. That is, a new subblock record is being created in Edit Mode and is yet to be submitted to the database.
Example:

var row = currentSubblockRecord ("subblockID");

message ("Record " + row);

 Back to Top

deleteAllRecords([showAlert])

Description:

This function cycles through all records in the found set, deleting one record at a time. If a findAll operation is performed prior to executing this command, it will delete all parent records associated with the current block. This may include all sub-block records if they are linked to the parent record in the database design. If the showAlert option is set to false:

deleteAllRecords (false)

The delete function is performed without first displaying the warning message:

This will delete ALL records in the found set.
Do you want to continue?

Click OK to continue or Cancel to exit the operation without first performing the delete operation.

The example below searches for the text: 'a new record' in the field: projectname4. If one or more records are found, the user is prompted to delete the records.

Example:

if (getMode () != "Find")

enterFindMode ();

performFind ("projectname4", "a new record");

deleteAllRecords ();

 Back to Top

deleteAllSubblockRecords("subblockId"[, showAlert])

Description:

Deletes all records in the specified subblock. If showAlert is TRUE, a warning message is displayed before deleting the records to allow the user to cancel the operation. If the showAlert option is set to FALSE, the delete function is performed without first displaying a warning message.

Example:

if (getMode () != "Find")

enterFindMode ();

performFind ("projectname4", "a new record");

deleteAllSubblockRecords ("subblock6", true);

 Back to Top

deleteRecord([showAlert])

Description:

This function deletes the current record.

If the showAlert option is TRUE or blank (the default), a warning message is displayed:

Are you sure you want to delete this record?

Click OK to continue or Cancel to exit the operation without first performing the delete operation.

If FALSE, the record is deleted without first displaying a warning message.

Example:

The example below searches for the text: 'a new record' in the field: projectname4. If one or more records are found, the user is prompted to delete the first record found.

if (getMode () != "Find")

enterFindMode ();

performFind ("projectname4", "a new record");

deleteRecord ();

 Back to Top

deleteRecords("model", "keyFieldAlias", "keyValue", isDateValue, isNumericValue[, "callbackFunction"])

Description:

This function deletes the nominated record(s) in the table (referred to in model) whose key field (keyFieldAlias) matches the criteria set by keyValue.

model - The model that defines the database table to be deleted.

keyFieldAlias - The name of the key field.

keyValue - The search condition.

isDateValue - Indicates that keyValue is in date format.

isNumericValue - Indicates that keyValue is in number format.

Note: If isDateValue and isNumericValue are both FALSE, the system assumes that keyValue is in text format.

callback function - Sets the script name of a function to be called on completion.

Example:

The example below deletes all records whose Owner Organization is "Test Org" in the table referenced by the model security_ipfilter.

deleteRecords("system/security_ipfilter", "Owner_Organization", "="+ "Test Org", false, false);
 Back to Top

deleteSubblockRow("subblockId", row, showAlert)

Description:Deletes the specified subblock row. If the showAlert option is set to true:

deleteRecords (true)

The delete function is performed without first displaying the warning message:

Delete this sub-page record?

Click OK to continue or Cancel to exit the operation without first performing the delete operation.

Example:deleteSubblockRow("subblock12", 1);
 Back to Top

duplicateRecords("model", "searchAlias", "searchValue",
["isDateSearch",] ["replaceAlias1", "replaceValue1"
[... , "replaceAliasN", "replaceValueN"][, "returnAlias"]])

Description:

This command allows one or more records to be duplicated (in the table referenced by 'model' and whose searchAlias field meets the condition defined in searchValue).

If the data type of the search field is a date, isDateSearch is TRUE, otherwise, it is FALSE.

After duplicating the record(s), fields (replaceAlias) can be changes to new values specified by replaceValue.

A value (usually the primary field value of the new record) can be returned in the parameter returnAlias.

Example: var person = duplicateRecords
("data/contacts_person", "contacts_person.primary",
"=" + getElement ("fkperson"), false,
"contacts_person.Title", "",
"contacts_person.First_Name", "",
"contacts_person.Middle_Name", "",
"contacts_person.Surname", "",
"contacts_person.Preferred_Name", "",
"contacts_person.Position", "",
"contacts_person.Salutation", "",
"contacts_person.contact", "",
"contacts_person.D_O_B", null,
"contacts_person.Notes", "",
"contacts_person.primary");
 Back to Top

duplicateRecordsReplaceFromList("model",
"searchAlias", "searchValue", ["isDateSearch",]
"replaceAlias", "replaceValueList"[, "returnAlias"]) ")

Description:

This command allows one or more records to be duplicated (in the table referenced by 'model' and whose searchAlias field meets the condition defined in searchValue).

If the data type of the search field is a date, isDateSearch is TRUE, otherwise, it is FALSE.

After duplicating the record(s), fields (replaceAlias) can be changed to new values specified by replaceValueList.

A value (usually the primary field value of the new record) can be returned in the parameter returnAlias.

Example:
 Back to Top

exportRecords("exportType", "templateFile", "exportFields", "exportGroupAliasList", "MYOBconstantNameList", "MYOBconstantValueList", "MYOBflaggedAlias") ")

Description:
Example:
 Back to Top

flushCache()

Description:Re-Loads data from the server. This function is usually used in other system functions, but it can be used if you need to refresh current data
Example:

flushCache()

 Back to Top

getLastInsertedRecordValue("columnName", "elementId")

Description:Returns last inserted value for block or subblock identified by elementId.
Example:

var totalSubRecords = totalSubblockRecords ("subblock6") + 1;

clearLastInsertedRecord ("subblock6");

unlockSubblockRow ("subblock6", totalSubRecords);

setRowElement ("subblock6", "propositionname6", "Testing clearLastInsertedRecord", totalSubRecords);

lockSubblockRow ("subblock6", totalSubRecords , true);

message (getLastInsertedRecordValue ("projects_proposition.Proposition_Name", "subblock6"));

 Back to Top

getModifiedSubblockRows("subblockId")

Description:Returns array contains NUMBERS of subblock rows has been modified.
Example:
 Back to Top

importRecords ()

Description:
Example:
 Back to Top

insertRecord("modelName", "alias1", "value1", "alias2", "value2", ... "aliasN", "valueN") ")

Description:Inserts empty record to the database. When alias/value pairs are specified those values will be inserted into the relevant fields in the table.
Example:

insertRecord("contacts_addressdefault");

 Back to Top

insertRecords("modelName", aliasList, valueList1, valueList2, ..., valueListN)

Description:Insert records to the database from one dimension arrays.
Example:

var aliases = new Array("First_Name", "Last_Name");

var values1 = new Array("Rob", "Napier");

var values2 = new Array("Ben", "Penney");

insertRecords("contacts_person", aliases, values1, values2); ####

 Back to Top

insertRecordsFromArrays("modelName", aliasList, valueListList, ["callbackFunction"])

Description:Insert records to the database from multi- dimension array.
Example:

var aliases = new Array("First_Name", "Last_Name");

var values1 = new Array("Rob", "Napier");

var values2 = new Array("Ben", "Penney");

var values = new Array(values1, values2);

insertRecordsFromArrays("contacts_person", aliases, values); ####

 Back to Top

lockSubblockRow ("subblockId", "row", "alwaysCommit")

Description:Locks the nominated subblock record.
Example:newRecord();
 Back to Top

newRecord()

Description:Performs Record->New from context menu.
Example:newRecord();
 Back to Top

replaceData("model", searchAliasList, searchValueList, isDateSearchList, replaceAliasList, replaceValueList)

Description:Performs search and replace, requires FULL model name. Each parameter (except model) needs to be an Array.
Example:

replaceData("data/contacts_person", new Array("First_Name"),

new Array("Rob"), new Array(false), new Array("First_Name"),

new Array("Robert"));

 Back to Top

restrictSubblockView("subblockId", isDateSeries, "dateFormat", "modelDotAlias1", "value1", "modelDotAlias2", "value2", ... "modelDotAliasN", "valueN")

Description:Restricts the data that is shown in a subblock. Can be used multiple times to restrict the subblock further.
Example:
 Back to Top

revertRecord()

Description:Rollback record's edited values to their initial values.
Example:

revertRecord(); ####

 Back to Top

selectRecords("modelName", "alias1", "=value1", "alias2", "=value2", ... "aliasN", "=valueN", nullSeparator, "sortAlias1", isAscendingOrder1, "sortAlias2", isAscendingOrder2, ... "sortAliasN", isAscendingOrderN)

Description:Performs SELECT request from the server.
Example:

var table;

var info;

var index;

var tableColumnCount;

table = selectRecords("data/contacts_personmember", "primary", "=" + getLoginPersonmember());

info = "";

if(table.length >= 2)

{

tableColumnCount = table[0].length;

for(index = 0; index < tableColumnCount; index++)

info += table[0][index] + " := " + table[1][index] + "\n";

message("Your personal membership information is as follows:\n" + info);

}

else

message("Your personal membership record was not found."); ####

 Back to Top

setRowElement ("subblockId", "elementId", "value", "row", "triggerChange")

Description:
Example:
 Back to Top

shiftRecordsByDays("metamodelDotRelationship", "days", "restrictAliasList", "restrictOperatorList", "restrictValueList", "restrictIsDateList", "aliasToShiftList", "skipHolidays")

Description:####
Example:
 Back to Top

submitRecord(alwaysCommit)

Description:Performs commit changes to the db. If alwaysCommit is set to true, the user will not be asked if they want to submit changes.
Example:submitRecord(true);
 Back to Top

totalRecords()

Description:Returns records count in block.
Example:

findAllRecords();

message("Records count: " + totalRecords());

 Back to Top

totalSubblockRecords("subblockId")

Description:Returns rows count in the specified subblock.
Example:

if (currentSubblockRecord ("subblock6") == totalSubblockRecords ("subblock6") + 1)

message ("New record.");

 Back to Top

unlockSubblockRow ("subblockId", "row")

Description:Unlocks a record in the nominated subblock.
Example:

findAllRecords();

message("Records count: " + totalRecords());

 Back to Top

unrestrictSubblockView("subblockId", doNotRefresh)

Description:Will remove any restrictions that were placed using the restrictSubblockView command. If doNotRefresh is set to true, the subblock data will not be updated.
Example:
 Back to Top

Security

cleanBlockPermissions("groupKey"[, ignoreErrors[, defaultDelete[, defaultModify[, defaultRead[, defaultWrite]]]]])

Description: This command adds to and/or removes entries from the block security permissions list for the nominated user group (groupKey). It is equivalent to clicking the Refresh button on the Block Details screen. Optional parameters allow the group to set default values for Delete, Modify, Read and Write options. An optional parameter (ignoreErrors) allows the operation to ignore error messages if any occur during the operation.
In the example below, the first script displays a list of all Groups access permissions. When a Group name is selected, the second script performs the clean up operation.
Example: Script 1 (showPullUp)
message("In the pull up list that follows, select a group for which you'd like to verify all permissions.");
pullUpList("admin.group", "security_group.primary", "doCleanUp", "security_group.Group_Name", true, 500, "security_group.Group_Name", " (", "security_group.primary", ")");
return;

Script 2 (doCleanUp)
cleanBlockPermissions(getLastListSelection(), true, true, true, true, true);
message("Replacement complete.\n" + getLastBlockPermissionsRemoved() + " permission(s) removed.\n" + getLastBlockPermissionsCreated() + " permission(s) added.");
return;
 Back to Top

cleanTablePermissions("groupKey"[, ignoreErrors[, defaultDelete[, defaultModify[, defaultRead[, defaultWrite]]]]])

Description: This command adds to and/or removes entries from the table security permissions list for the nominated user group (groupKey). It is equivalent to clicking the Refresh button on the Table Details screen. Optional parameters allow the group to set default values for Delete, Modify, Read and Write options. An optional parameter (ignoreErrors) allows the operation to ignore error messages if any occur during the operation. In the example below, the first script displays a list of all Groups access permissions. When a Group name is selected, the second script performs the clean up operation.
Example: Script 1 (showPullUp)
message("In the pull up list that follows, select a group for which you'd like to verify all permissions.");
pullUpList("admin.group", "security_group.primary", "doCleanUp", "security_group.Group_Name", true, 500, "security_group.Group_Name", " (", "security_group.primary", ")");

Script 2 (doCleanUp)
cleanTablePermissions(getLastListSelection(), true, true, true, true, true);
message("Replacement complete.\n" + getLastTablePermissionsRemoved() + " permission(s) removed.\n" + getLastTablePermissionsCreated() + " permission(s) added.");
 Back to Top

getLastBlockPermissionsCreated()

Description: This statement is normally used in association with the cleanBlockPermissions command to confirm that the last cleanup operation was successful. It returns the number of block permissions that were created.
Example: var changed;
changed = getLastBlockPermissionsCreated();
message("The last time blocks were cleaned using this page, " + changed + " permission" + (changed != 1 ? "s were " : " was") + " created.");
return;
 Back to Top

getLastBlockPermissionsRemoved()

Description: This statement is normally used in association with the cleanBlockPermissions command to confirm that the last cleanup operation was successful. It returns the number of block permissions that were removed.
Example: var changed;
changed = getLastBlockPermissionsRemoved();
message("The last time blocks were cleaned using this page, " + changed + " permission" + (changed != 1 ? "s were " : " was") + " removed.");
return;
 Back to Top

getLastTablePermissionsCreated()

Description: This statement is normally used in association with the cleanTablePermissions command to confirm that the last cleanup operation was successful. It lists the table permissions that were enabled for the current page.
Example: var changed;
changed = getLastTablePermissionsCreated();
message("The last time tables were cleaned using this page, " + changed + " permission" + (changed != 1 ? "s were " : " was") + " created.");
return;
 Back to Top

getLastTablePermissionsRemoved()

Description: This statement is normally used in association with the cleanTablePermissions command to confirm that the last cleanup operation was successful. It lists the table permissions that were enabled for the current page.
Example: var changed;
changed = getLastTablePermissionsRemoved();
message("The last time tables were cleaned using this page, " + changed + " permission" + (changed != 1 ? "s were " : " was") + " removed.");
return;
 Back to Top

Sort Find Print

addSort("fieldId", "ascending") implemented as addSort("field1[,field2[,field3]...]", "order1[,order2]...")

Description:

Performs sort by specified fields by specified orders (list divided by comma, order can be asc[ending] or desc[ending]).

Example:

addSort("firstname11", "desc");

doSort();

 Back to Top

clearSort()

Description:Clears sort order.
Example:

addSort("firstname11", "desc");

doSort();

clearSort();

addSort("lastname", "asc");

doSort();

 Back to Top

createSort()

Description:Shows oCLI sort palette.
Example:

if (getMode () == "Browse")

createSort ();

 Back to Top

doSort()

Description:Performs data sort (send request to the db).
Example:

addSort("firstname11", "desc");

doSort();

 Back to Top

findAllRecords()

Description:Performs FindAll command.
Example:

performFind("firstname11", "Rob");

if (confirm("Show all records?") == true)

findAllRecords();

 Back to Top

getSorts() throwns the error (Error: [Exception... "'Error: Query index out of bounds (0 to 4)' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no]) ####

Description:Returns array which contains current sort fields and sort orders.
Example:

addSort("firstname11", "desc");

doSort();

var sorts = getSorts();

for (index = 0; index < sorts.length; index++) {

var sort = sorts[index];

message("Sort field: " + sort[0] + " order: " + sort[1]);

}

 Back to Top

performFind("fields", "values", ignoreErrors)

Description:Performs find by given fieds an values (divided by comma
Example:

performFind("firstname11,lastname12", "Rob,Napier"); ####

 Back to Top

print("rtfTemplate", "outputFormat", startRecord, stopRecord)

Description:This command sends a request to the JasperReports reporting engine to perform a print operation. The print template is specified
Example:

####

 Back to Top

printWithDialog("defaultFormat", defaultStartRecord, defaultStopRecord, "onCloseScript", "overrideTemplate")

Description:Opens Print dialog, and sets the format, and print range. If onCloseScript is set, when the print dialog closes the specified script will be called. overrideTemplate will specify which print report to print. If it is not set, the print template with the same name as the block will be used.
Example:
 Back to Top

refineLastFind(field, value, field-n, value-n)

Description:Takes last find values and adds new find conditions####
Example:
 Back to Top

showAllRecords()

Description:

####

Example:
 Back to Top

sortSubblock("subblockId", "modelDotAlias1", isAscendingOrder1, "modelDotAlias2", isAscendingOrder2, "modelDotAliasN", isAscendingOrderN)

Description:Performs sort of subblock's data.
Example:

sortSubblock("subblock22", "contacts_addressdefault.City", false, "contacts_addressdefault.Address_Line_1", false);

 Back to Top

Text

formatAsDate("number"[, "dateFormat"])

Description: This function converts the parameter number from numeric format to a date format. The default format is set when the user logs on. This can be overridden by including the optional parameter dateFormat.
In the example below, the message displays the day of the week, date and month as shown:
formatAsDate
Example: message("The next day after the current completed date is:\n" + formatAsDate(getElementAsDate("txtDateCompleted") + (24 * 60 * 60), "[dddd] the [ddd] of [mmmm]"));
 Back to Top

formatAsNumber("number", "numberFormat")

Description: This function converts the parameter number to a formatted string.
In the example below, the message displays a number in the format:
Please enter a figure larger than $123456.79 with the last digit rounded in this example.
Example: message("Please enter a figure larger than " + formatAsNumber(123456.789, "$[t],[u].[d2]") + ".");

  Numeric Format Palette
Thousands (repeating)[t]
Units[u]
Decimal[]
Show 1, 2, ... decimal places[d1], [d2], ...
Show up to 1, 2, ... decimal place[-d1], [-d2], ...
Only show "." if there are decimal places[d?.]
Pad with '0' to 1, 2, ... digit[p1:0], [p2:0] ...
Pad with 'y' to x digits[px:y]
Negative part follows[-]
Zero part follows[-]
Black, Green, Red text[b], [g], [r]
An open square bracket - '['[]
Any fixed text except '['Enter without quotes or square brackets.
Contents of a field (e.g. currency)[c:model.alias]
 Back to Top

getDateNumber("dateText"[, "dateFormat")

Description: Converts the nominated date into a number that represents the number of secondsthat have elapsed since the start of 1/1/1970. The example below converts two dates into numbers, then calculates the difference. Finally, it converts the result back into the number of days.
Example: var firstDate;
var secondDate;
firstDate = input("Enter the first date (dd-mm-yyyy):");
secondDate = input("Enter the second date (dd-mm-yyyy):");
message("The difference between the dates (in days) is: " + ((getDateNumber(secondDate, "[dd]-[mm]-[yyyy]") - getDateNumber(firstDate, "[dd]-[mm]-[yyyy]")) / (60 * 60 * 24)));
 Back to Top

left("text", "length")

Description: This function selects characters starting from the first character in a string for a number of characters specified by the parameter length. In the example below, the contact's first name is found by selecting all characters to the left of the first space character ('Frederick'), as shown below:
left
Example: var contact = "Frederick John Smith";
var firstName;
firstName = left(contact, position(contact, " ", 1,1) - 1);
message(firstName);
 Back to Top

length("text")

Description: This function returns the length of a string as an integer.
In the example below, the length of the name (Frederick John Smith) is calculated and displayed as shown below:
length
Example: var contact = "Frederick John Smith";
var firstName;
firstName = left(contact, position(contact, " ", 1,1) - 1);
message(firstName);
 Back to Top

lowerCase("text")

Description: This function converts the specified text to lower case. In the example below, the contact's middle name is found by selecting all characters between the first and second space characters, then it is changed from upper case to lower case ('JOHN' to 'john'), as shown below:
lowerCase
Example: var contact = "Frederick JOHN Smith";
var middleName = lowerCase(middle(contact,
   position(contact, " ", 1,1) + 1, position(contact, " ", 1,2) -
   position(contact, " ", 1,1) - 1));
message(middleName);
 Back to Top

middle("text", "start", "length")

Description: This function selects characters from a string, from the specified start position for a number of characters specified by the parameter length. In the example below, the contact's middle name is found by selecting all characters between the first and second space characters, then it is changed from upper case to lower case ('JOHN' to 'john'), as shown below:
middle
Example: var contact = "Frederick John Smith";
var middleName;
middleName = middle(contact, position(contact, " ", 1,1) + 1,
   position(contact, " ", 1,2) - position(contact, " ", 1,1) - 1);
message(middleName);
 Back to Top

position("text", "search", "start", "occurrence")

Description: ####
position
Example: var contact = "Frederick John Smith";
var lastName;
lastName = right(contact, length(contact) -
   position(contact, " ", 1,2));
message(lastName);
 Back to Top

right("text", "length")

Description: ####
right
Example: var contact = "Frederick John Smith";
var lastName;
lastName = right(contact, length(contact) -
   position(contact, " ", 1,2));
message(lastName);
 Back to Top

substitute("text", "search", "replace")

Description: ####
substitute
Example: var contact = "Frederick John Smith";
var middleName;
middleName = substitute(contact, "John", "Jack");
message(middleName);
 Back to Top

upperCase("text")

Description: ####
upperCase
Example: var contact = "Frederick John Smith";
var middleName;
middleName = upperCase(middle(contact, position(contact, " ",
   1,1) + 1, position(contact, " ", 1,2) - position(contact, " ",
   1,1) - 1));
message(middleName);
 Back to Top

Thumbnails

setRowThumbnailSection("subblockId", "elementId", "row", "sectionName")

Description:####
Example:
 Back to Top

setThumbnailSection("elementId", "sectionName")

Description:####
Example:
 Back to Top

Variables

getGlobal("variableName")

Description:####
Example:
 Back to Top

parseFloat(string, number-base)

Description:####
Example:
 Back to Top

parseInt(string, number-base)

Description:####
Example:
 Back to Top

parseNumber("text")

Description:tries to parse text value to number (removes all non-digit characters, except minus and dot)
Example:

var f = parseNumber("-34a03s.4"); // result is -3403.4

 Back to Top

quickSort(array)

Description:Performs sorting for the array's elements.
Example:

var arr = new Array("a", 1, "c");

var sorted = quickSort(arr); ####

 Back to Top

setGlobal("variableName", "variableValue")

Description:Sets oCLI global variable.
Example:

setGlobal("temp", "90");

#### Store global variables in oCLI. Passing variables between pages.

 Back to Top

var variableName

Description:Declares the variable (optional).
Example:

var a;

var b, c, arr;

Scope of this function. Could overwrite value in another function.

 Back to Top

Windows

getWindowHeight()

Description:This function returns the height of the currently selected window as an integer. In the example below, the message could be:
getWindowHeight
Example: message("Window height is: " + getWindowHeight())
 Back to Top

getWindowWidth()

Description: function returns the width of the currently selected window as an integer. In the example below, the message could be:
getWindowWidth
Example: message("Window width is: " + getWindowWidth())
 Back to Top

openNewWindow("URL"[, "name"])

Description: This command allows applications to load standard HTML web pages from withing a once:radix application. It opens a new window or tab with the address set to the URL. The browser Preferences can be configured to always open HTML pages into a new window or tab. For example, in Camino open the Tabs option in Preferences..., then select:
openNewWindow
There are four standard name tags that can be appended to this command: _blank, _parent, _self and _top. If no name is specified, the default setting is _blank; which has the effect of opening a new window or tab. The other three standard W3C options should not be used as they have the effect of navigating away from your application. If you wish to re-open the same window or tab each time the command is executed, specify a non-standard name.
In the example below, a new window or tab is opened to display the HTML page (www.onceradix.com), the first time the command is executed. The window or tab is given the name: 'catalog'. The second command loads the new page (www.oncefabrik.com) into the same window or tab. It will continue to load all subsequent HTML pages referred to as _catalog into the same window or tab. The third command loads the page into a new window or tab, as does the fourth command. So, in this example, three new windows and tabs are created.
Example: openNewWindow("www.onceradix.com", "_catalog")
openNewWindow("www.oncefabrik.com", "_catalog")
openNewWindow("www.onceradix.com")
openNewWindow("www.oncefabrik.com")
 Back to Top

openPalette("paletteName", xValue, yValue)

Description: Shows the palette, specified by given name on specified position (or at screen center if position is omitted).
Example: openPalette("emailPalette");
 Back to Top

refreshBlock()

Description: Performs data refresh in block.
Example: refreshBlock();
 Back to Top

refreshSubblock("scriptId")

Description: Performs data refresh in subblock specified by its scriptId.
Example: refreshSubblock("subblock3");
 Back to Top

refreshSubblocks()

Description: Performs data refresh in all subblocks.
Example: refreshSubblocks();
 Back to Top

WWW

download("fileURL")

Description: This function activates the browser's Download utility to perform internal and external file transfers from any accessible web server. It eliminates the need for a user to manually navigate to the correct location.
The example below would download a specific version of Firefox from the mozilla.org website. The equivalent URI of the file returned would be:
   http://mozilla.ftp.iij.ad.jp/pub/mozilla/mozilla.org/firefox/releases/
   2.0.0.4/win32/en-US/Firefox%20Setup%202.0.0.4.exe.

Example: if(ask("Upgrade to Firefox 2.0.0.4?") == true)
   download("http://download.mozilla.org/
   ?product=firefox-2.0.0.4&os=win&lang=en-US");
 Back to Top

mailTo("address", "CC", "BCC", "subject", "body")

Description: This function is similar to the HTML mailto link. It opens the client's default email program and sets up an email in text format to one or more addresses, cc and/or bcc. The function allows the email to include a subject and message body.
Example: if(ask("Send a message to one of the authors of these fine examples?") == true)
mailTo("carrie@nerdshack.com, walter@gmail.com",
"bernie@nerdshack.com", "jennifer@gmail.com", "once:radix Examples", "Hi Carrie/Walter!\nThe examples are ready to review.\nBen");
 Back to Top

openURL("url")

Description: Deprecated by openWindow
Example:
 Back to Top

sendEmail("subject", "body", toList, CCList, BCCList, "from"[, "replyTo"[, "doAttachPrintJob", "outputFormat", "templateName", ["startRecord", "stopRecord"]]])

Description: This function sends an email in text format to one or more addresses, cc and/or bcc. The function allows the email to include a subject and message body.
Example: sendEmail("once:radix Email", "Here's some text.", new Array("ben@doitonce.net.au"), new Array(""), new Array("ben@doitonce.net.au"), "ben@doitonce.net.au");
return;
 Back to Top
© 2006 once:technologies Pty Ltd
46 Roseneath St, North Geelong VIC 3215 Australia
Phone: + 61 3 5278 6699, Fax: + 61 3 5278 6166
Privacy policy | Terms of use | Site Map