Constraint
It verifies the uniqueness(duplication) or integrity of the data to be saved.
- How-To
- Constraints are typically set for events where users input data by clicking or touching buttons.
- To receive the results of duplicate or integrity checks, set the Type to Property and the Target to Control.
- Set the Control Property selected in the Constraint Action to the Property of the Control to be validated for duplicates or integrity.
- Click Next to configure the parameters required by the Constraint. Set the Control to be validated for duplicates or integrity as the Parameter Key.
- Unlike other actions, Constraint is set in three stages. In the second stage, set the Parameter key entered earlier as Param. Then, select the Business Object Field to compare duplicates with the Param set as Control, and set the comparison criterion.
- Group is set to compare multiple Business Object Fields with an "and" condition. For updates, add a "not equal" condition for
sysId
to exclude the modified data from the comparison.
Note: Constraint executes an SQL query that creates and executes a WHERE clause with and conditions based on the Group criteria. If the query finds data, it returns No
. If multiple groups are set in the Constraint and one group returns No
, the result is No
.
Appendix. Using Consistency to limit the input to 4 digits
- In the View Attribute of the Control where the digit limitation is desired, set Properties > Length > Maxlength to
4
. - In the Action Designer's Constraint settings, set the Mapping Control Name to the Control where the Click Event occurs.
- Select the Control you want to check the input digits for and set the Parameter Key.
- Choose Action consistency, select
Data Length
for Operation. Select the Parameter Key entered in step 3 forSource Param
, and setOperation Value
to3
.
Note: If you input 100
for the fare code, it will be replaced by the data length 3
. It will then compare against the set Operation Value
, and based on the result, it will return data.success as Yes
.
- Display Constraint validation errors to users via Alert.