HELP!

Using JavaScript in the Viabl.ai Platform

This section describes how to utilise JavaScript in Viabl.ai (written in the standard JavaScript language) together with a number of special Viabl.ai constructs.

Viabl.ai allows the developer to write custom scripts using the JavaScript language to perform calculations and implement data manipulation algorithms at runtime. Scripts can either be contained in re-usable Object Scripts or be embedded directly within Decision Trees using Add Scripting (JavaScript) Built Tool. Scripts can also embedded inside then Events of some Viabl Platform Objects.

In additions to the standard JavaScript language syntax, Viabl.ai supports the following special constructs:

Accessing Viabl.ai Objects

Use the # prefix to access Viabl.ai runtime Object values and Viabl.ai Object methods & properties in your JavaScript code.

Accessing Special Viabl.ai functionality

Additional specialised Viabl.aifunctionality can be accessed using the following:

Viabl Platform developers using JavaScript scripting must be aware of the potential side effects of The Viabl.ai Rules Engine Replay Stack on their code

The Viabl.ai JavaScript Editor

To use a Viabl.ai Object in the JavaScript editor, you can drag & drop the Object from the Available Objects panel, on the right hand side, instead of typing the Object Name.

JavaScript is a case-sensitive language. This means that language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalisation of letters. This applies to all the properties and methods of the Viabl.ai Objects

Pressing the CRTL-SPACE keys, after the dot in #ObjectName. and xpertrule. will show the full list of available properties and methods for this Object.

There are a number of keystroke shortcuts available in the editor...

  • Code Completion : CTRL-SPACE
  • Undo: CTRL-Z
  • Redo: CTRL-Y
  • Select All : CTRL-A
  • Goto start : CTRL-HOME
  • Goto end : CTRL-END
  • Find : CTRL-F or F3
  • Find Next : F3
  • Find Previous : SHIFT-F3
  • Find and Replace : CTRL-H
  • Indent Block : TAB
  • Un-indent Block : SHIFT-TAB
  • Toggle bookmark : CTRL-F2
  • Goto next bookmark : F2
  • Goto previous bookmark : SHIFT-F2
  • Clear all bookmarks : CTRL-SHIFT-F2
  • Select line : CTRL-L
  • Goto bracket: CTRL-M
  • Select between brackets: CTRL-SHIFT-M
The Viabl.ai JavaScript editor offer basic syntax checking to help the developer identify and correct syntax errors.

On This Page