formula

Methods

(static) eval(textExpressions) → {Promise.<any>}

At run-time, compiles and runs each element in a text expression as a formula. Returns the result of the last formula expression in the list or an error if an error is generated by any of the formula expressions in the list.

Parameters:
NameTypeDescription
textExpressionsstring

Any text expressions that you want eval to evaluate. Surround the text expression to be evaluated with braces ({ }) or quotation marks (" "). If you use quotation marks, escape quotes around individual text expressions within the formula with back-slashes (). If you use braces, escape the right brace. Use the plus sign (+) to concatenate text expressions.

See
Returns:

lastExpression The value of the last expression.

Type: 
Promise.<any>
Example
// Returns "rebar"
let x = "re";
rosettajs.Formula.eval('{x + "bar"}');

(inner) checkFormulaSyntax()

Checks a block of commented out formula language code for errors.

To Do
  • this needs to be implemented
Throws:

method not implemented

Type
Error

(inner) command(commandName, …commandParameters) → {boolean}

Executes a Domino command.

In the context of RosettaJS, the @Command is a Notes Formula function that does not exist in the functions of the Notes Formula language but rather an @Command command itself that accepts the command name to execute as its first argument and the accompanying command parameters as arguments 2 through n.

Parameters:
NameTypeAttributesDescription
commandNamestring

The name of the command you want to perform. See www.hcltechsw.com for a list of avaliable commands.

commandParameters*<repeatable>

Zero, one, or more parameters, depending on the command you're calling. Separate parameters with commas.

See
Returns:

True if the command executes successfully or false if the command does not execute successfully.

Type: 
boolean
Example
// Opens RECIPE.NSF to the 'Main' view, highlighting the first document whose value in the sort
// column matches the key 'Hot Chocolate'.
rosettajs.Formula.command("FileOpenDatabase", ["server", "RECIPE.NSF"], "Main", "Hot Chocolate" );

(inner) isValid()

Executes all validation formulas within the current form.

To Do
  • this needs to be implemented
Throws:

method not implemented

Type
Error

(inner) updateFormulaContext() → {void|Error}

Updates the context of a formula to a document currently being updated by the code. For example, if the code accesses a new form called "Response" by using rosettajs.Formula.command("Compose", "Response"), rosettajs.Formula.updateFormulaContext switches the context of the formula to this new form. Any subsequent functions in the code execute in the context of the Response document, not the current document.

See
Returns:

A promise that resolves when the context is updated or rejects with an error.

Type: 
void | Error
Example
// This example, creates a response document to the currently selected document then populates its fname and lname fields with the values of the fname and lname fields in the current document.
var tempfname = voltmx.rosettajs.Document.getField("fname");
var templname = voltmx.rosettajs.Document.getField("lname");
voltmx.rosettajs.Formula.command("Compose", "Response");
voltmx.rosettajs.Formula.updateFormulaContext();
await voltmx.rosettajs.Document.setField("fname", tempfname);
await voltmx.rosettajs.Document.setField("lname", templname);