Variable Constraints

Overview #

Variable Constraints restrict the input side of a variable. They prevent end users from breaking queries and scripts with invalid values. A bulk of the configuration for Node Variables is contained in the associated Variable Constraints, and while Node Variables are bound to a specific node in the pipeline, Variable Constraints are global. This means that much of the configuration used for variables can be reused.

Stock Variable Constraints #

Variable constraints are an important part of interacting with the underlying queries and scripts, but you do not have to spend time restricting values in all cases. edgeSuite ships with several stock constraints that you can use right out of the box. These stock constraints are unbounded in terms of the values that can be entered. They only limit input based on specific datatypes and characters. The stock variable constraints are a good option if you are prototyping and only need some basic constraints to get started with. The stock options include the following:

Name
Type
Description
Presentation
Realtime DATE This is an array of STRING values that represent different time intervals. These intervals are all relative to the current time, which means that they assume the current time and then determine how far back to go. The values range from “Last 5 Minutes” to “Last 5 years”. This constraint provides a good baseline for working with time series data. The user will be presented with a pull-down menu, which contains all the string representations of various time intervals.
Unbounded Number NUMBER This limits values to a numeric characters. Unbounded means there is no MIN and MAX value, so the user can enter whatever number they want. The user will be presented with a spinner control, that lets them manually type a number, or increment/decrement the number by a value of 1.
Unbounded String STRING This limits values to alphanumeric characters (letters and numbers). The user will be presented with a text input, which accepts a limited set of alphanumeric characters.

#

Using Variable Constraints #

Assume you want to pull back records for a specific “user_id”. To do this, you will need to use a Node Variable like the one shown in the example SQL below. If you were to map this new variable name to the stock “Unbounded String” constraint, then the user would be able to type whatever name they wanted into a text input. The only restriction would be to alphanumeric characters. To restrict a user’s input further, you would need to create a new variable constraint to use with this Node Variable.

WHERE user_id = {nodeVar.validUserIDs}

Adding Variable Constraints #

Suppose an administrator wants to restrict values by more than just the alphanumeric characters provided in the stock “Unbounded String” constraint. Perhaps you want to limit input down to only valid user_ids in the system. This would equate to selecting a valid user name from a pull-down rather than entering something into a text input.

There are several ways to add a new Variable Constraint:

  1. You can get to Variable Constraints globally through: System Menu ->  Manage -> Constraints
  2. You can get to Variable Constraints globally by clicking the Constraints icon from the left side vertical toolbar
  3. You can access Variable Constraints when working inside the pipeline, through the Add Variable UI:  Insert > Variable > Add Variable > Add New Constraint
Click  +  to create a new Variable Constraint.
In the New Variable Constraint dialog, you will first be prompted to select a Constraint Data Type. This lets the system validate whether a Variable Constraint can be used, based on the associated attribute type. Each constraint type has its own configuration associated with it.  Follow the links below for more details on each specific Data Type.
Supported Data Types
Constraint Description
Number A numeric range represented by MIN_VALUE, MAX_VALUE, and an INTERVAL.
String An array of discrete values – it can be STRING, NUMBER, BOOLEAN or mixed.
Realtime Custom An array of STRING values that represent time intervals based off the current date and time. (example: last 5 minutes)