Set a Default Value for a Field

Use the Value property in a business rule to set a default value for a field.

Suppose you have a form in which the user can enter a currency in the Currency Code field. If the user doesn't enter a value—that is, if the field is empty at runtime—you can populate the field with a default value. You can accomplish this by using the Value property to set the field to, say, "euro", if the user is in Italy. When the user updates the form and clicks Save, the value "euro" is saved in the field, unless the user changes it to something else.

If the business rule sets the field to Read Only, of course, the user won't be able to change it. But if the field is editable, the user can change the value simply by updating the field.

To set a value for a field:

  1. In the Fields and Regions editor, find the field you want to modify.
  2. Click the dash in the Value column to open a popup dialog for setting the value.


    If there’s already a value set for the field, click the value and select Edit Value in the popup menu. You can also select Remove Override in the menu to remove the value.

  3. In the popup dialog, do one of the following:
    • Select Clear Field Value to remove any default value already set for the field by other rules. For example, you can use this option to remove the value set by the Default built-in rule. When the rule is applied, this option makes the field's value empty (the value is set to null).
    • Select Set Field Value to enter a default value for the field, which can be:
      • A static value (like "euro"), or
      • An expression which typically uses one or more different variables (like $fields.BudgetDetails.CurrencyCode.$value()) to calculate the actual value shown at runtime. When you use an expression, the value is recalculated if a variable referenced in the expression changes.

        To help you create your expression, you can click (x) and select variables from the list:



        If you want to create a more complex expression, click Use Advanced Expression to open the expression builder. See Build Advanced Expressions for more on how to use the expression builder.

    Note:

    If you see a lock, this means the field has been locked by the Default built-in rule, and you can't override it. Values that should not be overridden might be locked by Oracle.

At runtime, if the business rule's conditions are met, the field will show the value set in the popup.