String Constraint

Overview #

A String Constraint is an array of string values that can be used as input for a Node Variable. It is represented in the administration UI as a pull-down.

String Constraint Properties #

Property
Description
Name A symbolic name used to globally represent this constraint in the system. This will appear in pull-down lists where constraint names are selected.
Static This toggle determines whether the array of values is static or non-static.

  • Yes: Static values will have to be manually entered as part of the configuration, and will not change. A list of one or more strings must now be entered in the Allowable Values pane.
  • No: Non-Static values will be derived from a specified attribute at runtime, and will change over time to reflect what is in the data. In addition to getting the values at runtime, the administrator can also specify additional static values to be added to the runtime values.
Dataset This property appears when you select No for the property “Static”. The pull-down allows you select an existing dataset in the system.
Attribute This property appears once a “Dataset” is selected. This pull-down lets you select an attribute name from the selected dataset.

The unique values contained in this attribute at runtime are the string values that will be presented to an end user. The current values for this attribute are displayed in the Allowable Values pane to give a preview of what the string values in the pull-down may be at runtime.

Use Value as Label Determines whether the value will appear as input, or whether some other attribute should appear.

  • Yes: The value will be used as the label in the pull-down.
  • No: A different attribute will be used as the label.
Label Attribute Attribute to use in place of value, when you select No for “Use Value as Label”.
Sort By If “Use Value as Label” is set to “No” then the administrator can specify how the values should be sorted. Note: the sort will be applied to the joined set of runtime values and static values.

Example of Using Dynamic String Constraint to Filter for NULL or All (* wildcard) in SQL statement: #

In the following dynamic constraint example, we have an integer status code with possible NULL value and we also added an “All” static value to let the user “clear” the page variable to see all data:

The datasource with a SQL statement that uses a Node Variable off of this constraint would look something like this:

select from {src.FakerEvents} where
{safeNodeVar.status} = '<ALL>'
OR ({safeNodeVar.status} = '<NULL>' AND status is null)
OR ({safeNodeVar.status} NOT IN ('<NULL>','<ALL>'AND status = {safeNodeVar.status})

And the visualization off of this datasource on a page would look like:

If the constraint’s values are all strings then the datasource’s SQL statement can be simplified as the following, since we do not have to worry about database number formatting issues for the number column:

select from nulltest where
value = {safeNodeVar.nullconstest} OR
({safeNodeVar.nullconstest} = '<NULL>' AND value is NULLOR
{safeNodeVar.nullconstest} = '<ALL>'