Custom Functions

Designers can now write and add custom JavaScript functions to a DataVoke environment!  

Functions can be used the same way as you use variables or properties in expressions and calculations. Use stored variable names to reference properties in a view adding nearly endless possibilities.

Create a New Function

There are two ways to add a Custom Function to your DataVoke environment.

  • In the Expression Editor click the green plus sign in the functions column.
  • Select Custom Function from the 'Create a New...' menu.

The Custom Expression Editor

Provide a detailed description designers can see in the Functions list in the Expression Editor. Just click the box with the pencil.

  1. Select 'myExpression' in the text and rename your Custom Function.
  2. Select the green text and paste in your Custom Function text.
  3. Save & Close (to Capture) to test your Custom Expression locally.
  4. Click Register (to Commit) to save your custom function to the database.

Add tags to your custom expressions to make sure they're included in packages.  If they are not included in the package the formulas and action chains using your custom expressions will not function correctly after importing the package to a new database.

If you want to learn more about JavaScript functions in general, Click Here.


Calculate the product of two numbers, and return the result:

function orderTotal(dvItemTotal, dvCost) {
    return dvItemTotal * dvCost;                // Function returns the product of dvItemTotal and dvCost

When the  function is called, the return value will end up in x.

var x = orderTotal(4, 3);  

As a result, when dvItemTotal = 4 and dvCost = 3, the orderTotal function would return 12.

Have more questions? Submit a request


Please sign in to leave a comment.