Variables & Constants

This page provides example code for working with Variables & Constants in the Integration Theme.

For Variables & Constants to be accessed via the API, they must be listed in the <permissions> block of DriveWorksConfigUser.xml and available to the current user's team.

For full configuration guidance, see Integration Theme Settings in DriveWorks Pro Help.

The shared config.js file for these examples is incomplete. Enter your own settings for the examples to function.

Get Specification Variables

View in SDK Docs

This example displays all of the Variables for a Specification with their values in a table.

If no Variables are shown, ensure they are listed in DriveWorksConfigUser.xml.

Variables

Name Value
Loading...

Get Specification Constants

View in SDK Docs

This example displays all of the Constants for a Specification with their values in a table.

If no Constants are shown, ensure they are listed in DriveWorksConfigUser.xml.

Constants

Name Value
Loading...

Update a Constant

View in SDK Docs

This example shows how Constant values can be updated via the API (if Constants are available and listed above).

If a Constant's value is accessible, but editing is not permitted (see below), a 403 'Forbidden' error will be thrown in the console when attempting to update the value.

Loading...

Important Note

To allow a Constant to be updated using the Integration Theme, it must be granted edit permissions.

By default, all Constants are read-only unless specifically marked with canEdit="true".

This is configurable per team in the <permissions> block of DriveWorksConfigUser.xml

Example Usage:

<team name="YourTeamName" canEdit="true" />

See Integration Theme Settings in DriveWorks Pro Help for more details.


Reacting to Constant/Variable changes

Once a Specification is rendered, you can listen for custom events fired when the value of a Constant or Variable changes, and access the new value that is automatically returned.

This is achieved by registering custom functions using:

For more information and sample code, see the Events example.