Query Rules

Query Rule is used to validate the value of a field(s) through the output values of a query expression. A query expression is an SQL query that is used to fetch records from a database. 

To apply this rule, the field(s) to which the query should apply need to be mentioned. This is followed by a Query expression for the field.  

For example, if the Name field must be validated from a set of Names of Managers, a query can be run to extract the name of the Managers, which can be associated to the Name field through the query rule.  

Executing the following query: 

 “select NAME from employee where DESIGNATION=’MANAGER’” would fetch out the names of the managers from a list of employees. The Name field can then be validated with this list of managers. 

To configure a Query Rule within a module:  

  1. Click on the Settings icon at top right corner on the Home page. 
  2. From the left menu bar, select Modules. 
  3. Select the module > Business Rules > Schema. 
  4. Identify the desired schema and click on Detail > Add Business Rule. 
  5. Under Rule Type, check Query Rule radio button. 
  6. Click Next. 
  7. Enter the name of the rule in Description.   
  8. Select the preferred Category for the rule.   
  9. In Fields, select the field(s) that need to be assigned the query rule. 
  10. Write the Query Expression, the output values of which would be required to validate the field values. 
  11. Write the desired Message in case the query expression validation fails. 
  12. Select Finish.