Comparison Rules

20R2 & Later

Studio includes a date comparison configurator that you can use to build simple date comparison rules without writing the rule expression in the Rules Editor. The date comparison configurator is a tree view of all date and datetime Items in your study.

Rules created in the comparison configurator all use the Query action. The query message depends on the operator you choose for the rule. See the Available Operators table for details.

Don’t use the comparison configurator to write rules that compare two dates that are both repeating (Items within a repeating Item Group, Form, or Event Group). If you need to compare two such dates, write a rule in the Rule Editor.


The Comparison Rule Configurator is only available in Studies created after the 20R2 (August 2020) release. These studies use version 2 of the CDMS data model. Contact your Veeva Services representative for details.

Users with the CDMS Study Designer standard role can perform the actions described below. If your organization uses custom Study Roles, your role must grant the following permissions:

Type Permission Label Controls
Standard Tab Studio Tab

Ability to access the Studio tab

Functional Permission Design Study

Ability to create study design definitions and a study schedule from Studio

If your Study contains restricted data, you must have the Restricted Data Access permission to view it.

Learn more about Study Roles.

Accessing the Date Comparison Configurator

To access the date comparison configurator, navigate to your Study in Studio. Then, in the Navigation panel, click Comparison Rules.

Click Comparison Rules in the Navigation panel

Viewing Comparison Rules

The date comparison configurator lists all date and datetime Items in your study as a tree. You can expand and collapse this tree to locate specific components.

To expand or collapse a component, click the Caret ( and ). You can also expand and collapse the entire tree by clicking Expand () and Collapse () in the header.

Expand all

You can search for components and choose to show only Items with or without a specified comparison.

Filter for unspecified items

By default, Vault shows all date-type Items. To view datetime-type Items, select DateTime for data type. To return to the list of date-type Items, choose Date.

Select a Data Type

How to Create a Comparison Rule

To create a comparison rule:

  1. Navigate to Studio > Comparison Rules for your Study.
  2. Optional: If you want to create a rule on a datetime-type Item, select DateTime for Data Type. Otherwise, leave this set to Date. Select a Data Type

  3. In the tree view, expand components until you can view the Item you want to compare.
  4. If the component already has a comparison rule:
    • Hover over the Name to show the Actions menu.
    • From the Actions menu, select New Comparison. This adds another row to the component. New Comparison action

    • Continue with these instructions in the newly added row.
  5. Select an Operator. See a list of operators below.
  6. To add a Study Reference for Compare To:
    • In the Study References panel, begin typing the Name or Label of the Item or Event. Note that you must type at least two (2) characters for Vault to begin searching. Vault returns all matching Items in all locations that an Item is used throughout the casebook schedule.
    • Select the Item or the Event from the results. Select an item from the results

    • To add the reference to the Compare To field, click the Study Reference. Add an item

    You can also use a casebook variable, instead of choosing study reference. Skip to Step 6 to do so.

  7. To add a Casebook Variable for Compare To:
    • Click Casebook Variables to open that panel.
    • Optional: Search for a Casebook Variable.
    • Click a Casebook Variable to add it. Note that you can only add variables with an assigned value. Add a casebook variable
  8. Optional: Once you’ve chosen an_ Item_, Event, or Casebook Variable for Compare To, you can replace it by clicking Remove () and then selecting a new one.
  9. Click out of the component row. This prompts Vault to save your changes. When saving, Vault generates a Rule Name.

Unknown Dates & Times: Vault automatically applies the MinDate() and MinDateTime() functions to any dates or datetimes that allow unknowns.

How to Remove a Comparisons

To remove a comparison rule:

  1. Navigate to Studio > Comparison Rules for your Study.
  2. Locate the rule you want to remove in the tree.
  3. Hover over the Item to show the Actions menu.
  4. From the Actions menu, select Clear. Clear action

  5. In the confirmation dialog, click Clear. Clear confirmation dialog

Vault removes your rule configuration. This change applies immediately in development environments and will take effect with the next deployment in all other environment types.

Available Operators

The following comparison operators are available for use:

Operator Query Message
cannot be after Item Label cannot be after Compare To Label.
cannot be after or equal to Item Label cannot be after or equal to Compare To Label.
cannot be before Item Label cannot be before Compare To Label.
cannot be before or equal to Item Label cannot be before or equal to Compare To Label.
cannot be equal Item Label cannot be equal Compare To Label.
must be equal to Item Label must be equal to Compare To Label.