Condition Builder Guidelines Print this Page
Version 2.0.0.0
 
Contents
Return to Top
 
Description
Return to Top

Condition Builder enables users to create a Boolean (true or false) statement that returns filtered results. Here is a sample use case:

An human resources representative requires a list of US and Canadian employees who earn a salary greater than 50,000 USD. In this case, users can create a condition to filter objects based on country and salary. A textual representation of the condition would be:

Salary > 50000 AND (Country = “US” OR Country = “Canada”)

 
Condition Overview
Return to Top

This section provides an overview of the different elements that make up a condition.

Condition Elements
A condition combines three basic elements to return a filtered set of results: an attribute, a value, and an operator.

Figure 1. The three elements of a condition

The three elements of a condition:

  1. Attribute: A field within a record
    Example: If Customer Information is a record in a database, then the Country field is one of attributes within that record.

  2. Operator: Determines equality or difference between the attribute and the value
    Example:
    • Equality: Country = “US”
    • Difference: Country != “US


    Common Operators for Text
    Operator Example Description
    = (Is) Employee Name =John Smith The employee name must be John Smith or no results are returned.
    != (Is not) Employee Name != John Smith All employee names are returned except John Smith.
    Starts With Employee Name Starts With Sm The employee name must start with Sm or no results are returned.
    Ends With Employee Name Ends With th Employee name must end with th or no results are returned.
    Contains The employee name Contains Smith The employee name must contain Smith or no results are returned.
    Does Not Contain Employee Name Does Not Contains Smith All employee names except Smith are returned.
    Is Blank Employee Name Is Blank All records with blank in the Employee Name field are returned.
    Is Not Blank Employee Name Is Not Blank All records with data in Employee Name are returned.

    Common Operators for Numbers
    Operator Example Description
    = (Is) Salary = 50000 Returns results for all employees whose salary is 50,000 USD a year.
    != (Is not) Salary != 50000 Returns results for all employees whose salary is not 50,000 USD a year.
    > (Greater than) Salary > 50000 Returns results for all employees who earn more than 50,000 USD a year.
    < (Less than) Salary is > 50000 Returns results for all employees who earn less than 50,000 USD a year.
    >= (Greater than or equal) Salary >= 50000 Returns results for all employees who earn greater than or equal to 50,000 USD a year.
    <= (Less than or equal) Salary <= 50000 Returns results for all employees who earn less than or equal to 50,000 USD a year.
    Is Blank Salary Is Blank All records with a blank in the Salary field are returned.
    Is Not Blank Salary Is Not Blank All records with data in the Salary field are returned.

  3. Value: The content of a field within a record. The value is user defined.
    Example: US is the content of the Country field.

Compound and Nested Conditions
A compound condition is the combination of two or more conditions linked by a logical operator. You can nest (group) two or more conditions to form a separate statement within a compound condition. This example shows compound and nested conditions.

Figure 2. A compound condition containing three conditions with two nested conditions

The elements of the compound condition are defined as follows:

  1. A condition consists of an attribute and value that are connected by an operator (such as =) that returns true or false.
    Example: Country = US

  2. A compound condition combines two or more conditions that are connected by logical operators (for example, AND) that return true or false.
    Example: Country = “US” OR Country = “Canada”

  3. A nested condition uses parentheses to group conditions that are contained in another condition and are connected using AND and OR. You can also nest one nested condition within another nested condition.
    Example: A user might find a record for the year 2008, where the country equals US and the salary is greater than 50,000 or where the country equals Canada and the salary is greater than 70,000. The nested condition would look like this:
    (Country = “US” and Salary > 50000) OR (Country = “Canada” and Salary > 70000)
  4. Logical operators combines two conditions together to return a set of results.
    Example: AND is used to join the "Country = US" AND "Salary > 50000" so that all records containing US and a salary greater than 50,000 are returned.
Note: A logical operator is part of a compound condition. You can create compound conditions in two ways: by setting the logical operators individually or by setting them globally using all or any. Setting logical operators globally makes sense for unnested conditions, but not for nested conditions.

Common Logical Operators
Operator Example Description
AND (&&) Country = 'US' AND Salary > 50000 Returns results only if both condition lines are met
OR (||) Country = ‘US’ OR Country is ‘Canada’ Returns results if either condition line is met
 
Condition Builder Types
Return to Top

Both experienced and inexperienced users build conditions. Two Condition Builder tools are available to meet the needs of different user types.

  1. The Basic Condition Builder type provides novice users with a limited feature set that enables them to build short conditions using common words.

  2. The Structured Condition Builder type enables moderate-to-experienced users to write complex conditions that have hierarchical (nested) relationships.

Condition Builder Decision Table
Use this decision table to help determine what solution is most appropriate for different user types.

  Basic Structured
User Type Novice Moderate to Experienced
Number of rows (conditions) 10 or fewer Unlimited
User needs to construct hierarchical relationships (nesting) No Yes
 
Basic Condition Builder
Return to Top

The Basic Condition Builder tool enables inexperienced users who require a simple set of attributes, operators, and values to complete their tasks.

Scenario
The compensation manager is responsible for evaluating the compensation (salary, bonus, and so on) for many employees. The compensation manager:

  • Is a novice Condition Builder user
  • Uses a Condition Builder to filter and more easily manage a long list of employees
  • Needs only a simple set of attributes, operators, and values

Users can create conditions limited to 10 or fewer lines to ensure that the conditions are easy to create and maintain. Operators available to users include equals, not equals, greater than, and less than.

Common Word Operators
For the Basic Condition Builder, users can use common words, such as "Is" (for "=") and Is greater than" (for ">") for operators. Using common words enables users to more easily understand the condition that they are writing.

Word Operator Example Description
Is (=) Employee Name is John Smith The employee name must be John Smith or no results are returned.
Is Not (!=) Employee Name is not John Smith All employee names are returned except John Smith.
Is greater than (>) Salary is greater than 50000 Returns results for all employees who earn more than 50,000 dollars a year.
Is less than (<) Salary is less than 50000 Returns results for all employees who earn less than 50,000 dollars a year.
Greater than or equal (>=) Salary is greater than or equal to 50000 Returns results for all employees who earn greater than or equal to 50,000 dollars a year.
Less than or equal (<=) Salary is less than or equal to 50000 Returns results for all employees who earn less than or equal to 50,000 dollars a year.
Starts with Employee Name starts with Sm The employee name must start with Sm or no results are returned.
Ends with Employee Name ends with th The employee name must end with th or no results are returned.
Contains Employee Name contains Smith The e employee name must contain Smith or no results are returned.
Does Not Contain Employee Name does not contain Smith All employees except Smith are returned.
Is Blank Employee Name is blank All records with blank in the Employee Name field are returned.
Is Not Blank Employee Name is not blank All records with data in the Employee Name field are returned.

Note: You can use additional operators if they are appropriate for your use case.

Layout and Components
The Basic Condition Builder has a simple user interface that contains, at a minimum, a Name field and an editable table (with a maximum of five rows) for entering attributes, operators, and values. The Basic Condition Builder can appear in a page or dialog box.

Figure 3. Example of a Basic Condition Builder dialog box
Screen Components
Type Component
Dialog Box Title or Page Header The title or header must contain these elements:
  • Create Condition to enable users to create a condition.
  • Edit Condition to enable user to create a condition.
Form Layout The form layout must contain these elements:
  • (Required) A Name text field in which users enter the name of the condition.
  • (Optional) A Description text box in which users can enter a brief description of the filter.
  • (Required) A Match ALL/ANY option group:
    • Mutually exclusive values used to indicate that all of the conditions must be met before results are returned or if any one (or more) of the conditions needs to be met before results are returned. Values are:
    • ALL: Returns results only if all conditions are met.
    • ANY: Returns results if at least one condition is met.
  • Users can add product-specific fields to the form layout if necessary.
Conditions Table The table must contain these columns:
  • Attribute: A choice list (or LOV choice list) that contains a set of attributes predefined by the product team.
    • User cannot add new attributes to the list.
    • The operator is based on the attribute type (numeric, text, date, and so on).
      Example: The user selects Salary, and the operator automatically changes to < (less than).
  • Operator: An LOV choice list containing no more than 10 common word operators (instead of symbols), for example, "Is greater than" instead of ">."
    • Users can add additional operators to the LOV choice list if required by the use case.
  • Value: A text field that enables users to enter an alphanumeric value. You can use an LOV choice list for a small predefined set of values.
  • The logical operator is set to AND by default and hidden from users.

 Notes:

  • Nesting is not available in the Basic Condition Builder.
  • Table row limit: Because of the simplicity of the use case, the experience level of users, and overall purpose of the condition, the rows that appear in the table should be limited to 10 or fewer rows.
  • Noncontiguous row entry: If there are blank rows between those in which the user has entered data, those rows will be removed and replaced by the next below it that does contain data.
    Example: Users record data in rows 1, 2, and 4, but leave row 3 blank. They then save and close the Condition dialog box. As a result, row 3 (previously blank) is deleted, and row 4 moves up to replace row 3.

Accessibility Notes:

    • Field labels (for example, Attribute, Operator, and so on) are hidden but must be labeled.
    • Each row in the condition must be identified uniquely.
      Example:  Attribute: Row 1, Operator: Row 1
Buttons Buttons must include:
  • Save and Close: Saves the changes and closes the Create Condition dialog box.
    • The condition is checked for validation errors. If the condition contains errors, a message appears.
  • Cancel: Cancels the transaction and closes the dialog box
 
Structured Condition Builder
Return to Top

The Structured Condition Builder is for moderate to advanced users who have experience writing conditions. The Structured Condition Builder offers users a simple and structured interface for writing long and complex conditions that contain nests.

Scenario
An order manager creates and edits conditions using operators, variables, and a predefined set of attributes. The order manager needs to be able to quickly and easily build a complex compound condition that includes nesting as well as the AND and OR logical operators.

Layout and Components
The Structured Condition Builder:

  • Contains, at a minimum, a Name field and a panel with a toolbar and fields for entering attributes, operators, values, and logical operators
  • Enables users to nest conditions and preview their draft condition in a textual format as they write it

Because of the complexity of the interface and the potential length of the condition, you should make sure that the condition renders on a drill-down page.

Figure 4. Example of a Structured Condition Builder page
Screen Components
Type Component
Page Pages contains the following elements:
  • (Required) A Name text field in which users enter the name of the filter
  • (Optional) A Description text box that enables users to enter a brief description of the filter
  • (Optional) An Effective Date field that indicates the dates that the condition returns results
  • You can add product-specific fields to the form layout if necessary
Table Tables contain the following elements:
  • An Actions menu that contains these items:
    • Add
    • Duplicate
      ----------------
    • Delete
      ----------------
    • Add Nest
    • Delete Nest
  • Toolbar icon buttons:
    • Add (  )
    • Duplicate (  )
    • Delete (  )
      ----------------
    • Add Parentheses (  ): Nests and indents selected rows
    • Delete Parentheses (  ): Deletes the nesting and indention of selected rows.
Conditions Panel

The work space for the condition contains one row by default and space for four additional rows before the panel height increases.

The Condition panel must contain these columns:

  • Row Selector: A check box and row highlighting indicate selection
  • Attribute: An LOV choice list that contains a set of attributes predefined by the product team
    • Users cannot add new attributes to the choice list.
    • The operator is based on the attribute type (numeric, text, date, and so on).

Example: Users select Salary, and the operator will automatically change to < (less than).

  • Operator: An LOV choice list of common operators
  • Value: A text field that enables users to enter an alphanumeric value
    • You can use an LOV choice list for a small predefined set of values.
  • Logical Operator: Combines two conditions to return a set of filtered results
    • Values: AND or OR
    • Set to AND by default
    • This field should be hidden in the last row of the table.

Accessibility Note: Field labels (for example, attribute, operator, and so on) are hidden, but you must label them. You must also identify each row in the condition uniquely.
Example: Attribute: Row 1, Operator: Row 1

Buttons

Buttons (page actions) must include:

  • Validate: The condition is checked for validation errors. If errors are found, a message appears. Users can validate the condition at any time.
  • Save: Saves the changes and updates the object information in the base table.
    • The condition is checked for errors. If errors are present, a message appears.
    • The assumption is that conditions can be saved with errors.
  • Save and Close: Saves the changes and closes the window. The condition is checked for validation errors. If errors are present a message appears.
  • Cancel: Cancels the transaction, closes the page, and returns users to the referencing page.
Note: Because of the degree of complexity of any condition, it is recommended that users use the button configuration described previously. You can use an alternative set of buttons (page actions) that includes Validate, OK, and Cancel buttons depending on the save model.
Condition Text Preview

The Condition Text Preview text box displays the plain text version of the condition as it would appear if users were typing it as free text.

The condition text preview area is:

  • Required
  • Read only
  • Open by default

Technical Note: Consider using controlling and dependent field functionality to update the Condition Text Preview text box as users move from one field to the next.

For more information on controlling and dependent field functionality, see Form Layout Usage Guideline, Controlling and Dependent Fields.

Condition Panel
This section discusses:

  • The row selection model
  • Basic row behaviors
  • Condition panel behaviors

The Row Selection Model
The row selection model differs from standard table behavior in these ways:

  • A check box and highlighting are used to indicate that a row has been selected.
Figure 5. Example of a selected and highlighted row
  • After users perform an action, such as duplication or nesting, previously selected rows are deselected and the highlighting is removed.
  • New rows do not appear as selected or highlighted when added to the condition panel. If users leave a newly added row selected, they must deselect the row, and this could cause users to mistakenly perform an action on the row.

Basic Row Behaviors
Because users write conditions from the top down, common row interactions, such as Add and Duplicate, behave differently in conditions than they do in standard tables. Common row interactions include:

  • Add New Row (no selection): A new row is inserted after the last row in the table.
  • Add New Row (row selected): A new row is added below the selected row.
  • Add New Row (multiple rows selected): One new row is added below the last selected row.
  • Duplicate Row: The duplicate row is added below the selected row.
  • Duplicate Multiple Rows: The group of duplicated rows is added below the selected group.
  • Duplicate Noncontiguous Duplication: The group of duplicated rows is added below the selected row or group of rows. For example, if users select rows 2, 3, and 5, and then click the Duplicate icon button, the duplicated rows appear below the 2 and 3 grouping and below row 5.
  • Delete Row: The selected row is deleted from the table. All rows below it move up to fill the space.
Note on noncontiguous row entry: If users leave blank rows between those in which they have entered data, those blank rows are removed and replaced by the next row below it that does contain data. For example, let's say that a user records data in rows 1, 2, and 4, but leaves row 3 blank. The user then saves and closes the Condition dialog box. The result: row 3 (previously blank) is deleted, and row 4 moves up to replace row 3.

Condition Panel Behaviors
This section specifies the interactions associated with writing a condition:

Adding a New Row (None Selected)

1. Users click the Add icon button or select Add Row from the Actions menu.

Figure 6. Example of adding a new row without making a selection

The results of this interaction are:

  • A new row is added below the last row of the table.
  • The new row is not selected or highlighted.
  • The logical operator is added at the end of the second to last row. Default values are:
    • Attribute: None
    • Operator: "="
    • Value: None
    • Logical Operator: Add the logical operator to the end of the second-to-last row. This field is never available in the last row of the table.
  • If the last row in a condition is nested, and users add a new row without first selecting a row, the new row is added to the end of the condition but is not inside the nest.

Adding a New Row (Row Selected)

  1. Users select the check box for a row, which highlights the row.
  2. Users click the Add icon button or select Add from the Actions menu.
Figure 7. Example of adding a new row with a row selected

The results of this interaction are:

  • A new row (including a logical operator) is inserted below the selected row.
  • If several rows are selected, whether contiguous or noncontiguous, the new row is added below the last selected row.
  • The previously selected row is deselected, which clears the check box and removes the highlighting.
  • The new row is not selected or highlighted.
  • Default values of the new row are:
    • Attribute: None
    • Operator: "="
    • Value: None
    • Logical Operator: AND. Add the logical operator to the end of the second-to-last row. This field is never available in the last row of the table.

Duplicating a Row

  1. Users select the check box for a row, which highlights the row.
  2. Users click the Duplicate icon button or select Duplicate from the Actions menu.
Figure 8. Example of duplicating a row

The results of this interaction are:

  • A duplicated row (including a logical operator) is inserted below the selected row. If users select several rows, whether contiguous or noncontiguous, the new row is added below the last selected row.
  • The previously selected row is deselected, which clears the check box and removes the highlighting.
  • The new row is not selected or highlighted.
  • Default values of the new row are:
    • Attribute: None
    • Operator: "="
    • Value: None
    • Logical Operator: AND. The logical operator is added to the end of the second-to-last row. It is never available in the last row of the table.

Deleting a Row

  1. Users select the check box for a row, which highlights the row.
  2. Users click the Delete icon button or select Delete from the Actions menu.
Figure 9. Example of deleting a row

The results of this interaction are:

  • The row is deleted and subsequent rows move up to fill the space.
    • Users can select rows contiguously and noncontiguously and delete them using the delete action.
    • If users delete the last row, the logical operator is removed from the new last row.

Adding Parentheses

  1. Users select the check boxes for one or more rows, which highlights the rows.
  2. Users click the Add Parentheses icon button or select Add Nest from the Actions menu.
Figure 10. Example of adding parentheses

The results of this interaction are:

  • The selected rows are indented (not including the check box).
  • An open parenthesis is added before the first row and a close parenthesis is added after the last row. If users select nonsequential rows, single or contiguous rows are grouped into their own nests.
  • The last logical operator in the nested group is dropped below the nest to form a distinct visual grouping of the nest.
    •  If the last row in the condition is part of a nest, it would not have a logical operator.
  • Previously selected (newly nested) rows become deselected.
  • The new row is not selected or highlighted.

Steps Adding a New Row to a Nest

  1. The user selects nested row using a check box. The row becomes highlighted.
  2. The user clicks the Add icon button (or selects Add from the Actions menu).
Figure 11. Example of adding a new row to a nest

Results

  • A new row (including logical operator) is added to the nest below the selected row.
  • The previously selected row becomes deselected.
  • The new row is not selected or highlighted.
  • Default Values of New Row:
    • Attribute: None
    • Operator: "="
    • Value: None
    • Logical Operator: AND (added to the end of the second-to-last row; never available in the last row of the table)
  • If the last row in a condition is nested, and a user adds a new row without selecting a row, the new row will be added to the end of the condition but will not be included in the nest.

Steps Adding a Second Level to a Nest

  1. The user selects one or more rows using check boxes. The rows become highlighted.
  2. The user clicks the Add Nest icon button (or selects Add Nest from the Actions menu).
Figure 12. Example of creating a second level within a nest

Results

  • The selected rows are indented an additional level. An open parenthesis is added before the first row of the new nest, and a close parenthesis is added after the last row of the new nest.
    • If the selected rows are at the beginning or the end of a nest, double parentheses will appear.
    • If non-sequential rows are selected, each individual row will be added in its own nest.
  • The logical operator is dropped below the nest to form distinct visual grouping of the nest.
    • If the last row of the condition is part of the nest, it will not have a logical operator.
  • The previously selected row becomes deselected.
  • The new row is not selected or highlighted.

Steps Adding a Third Level to a Nest

  1. The user selects the rows using a check box. The rows are highlighted.
  2. The user clicks the Add Nest icon button (or selects Add Nest from the Actions menu).
Figure 13. Example of nesting three levels deep

Results

  • The selected rows are indented a third level. An open parenthesis is added before the first row of the new nest, and a close parenthesis is added after the last row of the new nest.
    • If the selected rows are at the beginning or the end of a nest double parenthesis will appear.
    • If non-sequential rows are selected, each individual row will be added in its own nest.
  • The logical operator is dropped below the nest to form distinct visual grouping of the nest.
    • If the last row of the condition is part of the nest, it will not have a logical operator.
  • The previously selected row becomes deselected.

The new row is not selected or highlighted.

Steps Deleting a Row from a Nest

  1. The user selects row using a check box. The row is highlighted.
  2. The user clicks the Delete icon button (or selects Delete from the Actions menu).
Figure 14. Example of deleting a row from a nest

Results

The row is deleted and subsequent rows move up to fill the space.

  • Users can select rows contiguously and noncontiguously and delete them using the delete action.
  • If the deleted row is the last in the nest, the close parenthesis moves up to the next row.
  • If users delete all of the rows in a nested group, the parentheses are also deleted.

Steps Deleting Parenthesis

  1. User selects the rows using a check box. The rows are highlighted.
  2. User clicks the Delete Nest icon button (or selects Delete Nest from the Actions menu).
Figure 15. Example of deleting parentheses

Results

  • The rows are no longer indented and the parentheses are removed. If you have multiple levels of nesting (indentation), the selected rows are outdented one level.
  • The logical operator moves back up inline with the last row because it is not the last row in the condition. If the last row in the condition is part of the nest, it does not have a logical operator.
  • The row is deselected.
  • The row cannot be removed from a nest nonsequentially.
    For example: If a nest contains three rows, and user selects the second row and then clicks the Delete Nest icon button, all of the rows are unnested.
 
Validation
Return to Top

The extent of validation depends on each team's use case and user type. The validation process differs according to the type of Condition Builder solution used.

Validation is performed when the user clicks the Validate button or exits the page. At a minimum, conditions should be verified to:

  • Ensure that you entered data in the required fields
  • Ensure that you have made a selection in each of the Attribute, Operator, Value, and Logical Operator fields
  • Ensure that you have not entered any invalid characters in the Value field (invalid characters include @, >, %, and so on)
  • Ensure that the operator matches the attributes and value that you entered in the Value field
    For example, if users enter "greater than" in the Operator choice list and enter US in the Value field, the system should return an error.

Users can save a condition with errors, and a status indicating that the condition has been saved but contains errors appears. Individual teams can decide to override this option and require users to fix all errors before the condition can be saved.

Error Message Display
Validation messages should appear in accordance with the Records Messaging Guideline and the Error Message Design Pattern.

 
About Oracle | Legal Notices | Terms of Use | Your Privacy Rights