Default Segment Values
To populate a flexfield segment with a default value when a row is created, specify a default type of constant, parameter, or Groovy, and a default value or expression.
To synchronize a segment's value with another field's value whenever it changes, specify the derivation value to be the flexfield parameter from which to derive the attribute's value. Whenever the parameter value changes, the attribute's value is changed to match. If you derive an attribute from a parameter, consider making the attribute read-only, as values entered by users are lost whenever the parameter value changes. When setting a default value or deriving a default value from a parameter, only those attributes designated by development as parameters are available for selection. Different combinations of making the segments read only or editable in combination with the default or derivation value or both, have different effects.
If your segment's default type is Groovy, you can set the Groovy expression you need using the expression builder. To open the expression builder, select Groovy Expression as your Default Type and click the Groovy Expression Builder icon. But you should know that Groovy defaulting doesn't support derivation when a dependent parameter changes. The expression is evaluated only at segment creation.
New usages of Groovy default values and validators in flexfields are deprecated because they won't be automatically upgraded in future releases. However, flexfields already using Groovy will continue to work. If you want to add Groovy expression to new flexfields, you must set the Flexfield Groovy Usage Support Restricted (ORA_FND_FLEX_GROOVY_RESTRICTED) profile option to N.
The following table maps these different combinations. Initial action corresponds to the row for the attribute value being created in the entity table. If the default value is read only, it can't subsequently be changed through the user interface. If the default value isn't read only, users can modify it. However, if the segment value is a derived value, a user-modified segment value is overwritten when the derivation value changes.
Default Type |
Default value specified? |
Derivation value specified? |
Initial action |
Action after parameter changes |
---|---|---|---|---|
None |
No |
Yes |
No initial segment value |
The changed parameter derivation value updates segment value |
Constant |
Yes |
No |
Default segment value |
N/A |
Constant |
Yes |
Yes |
Default segment value |
The changed parameter derivation value updates segment value |
Parameter |
Yes |
No |
The default segment value is the parameter's default value |
N/A |
Parameter |
Yes |
Yes, and same as default value |
The default segment value is the parameter's default and derivation value |
The changed parameter derivation value updates segment value |
Parameter |
Yes |
Yes, and different from default value |
The default segment value is the parameter's default value |
The changed parameter default value doesn't update segment value. Only the changed derivation value updates the segment value. |
Groovy Expression |
Yes |
N/A |
The default value of the segment is determined by evaluating the groovy expression. |
Groovy expressions are evaluated only at segment creation. They're not evaluated when a dependent parameter is modified. |
SQL |
Yes |
No |
The default segment value is the value returned by executing SQL statement |
N/A |
SQL |
Yes |
Yes |
The default segment value is the value returned by executing SQL statement |
The changed parameter derivation value updates segment value |
For Descriptive Flexfield, only the PARAMETER
bind variable is supported as the
default type in a SQL statement in the specified format:
#{PARAMETER.<PARAMETER_NAME>}
Other bind variables, such as SEGMENT
, CONTEXT
, and VALUESET
aren't supported in a SQL statement.
Also, the default type in a SQL statement is evaluated only when you
create a segment. They aren't evaluated when a dependent parameter
is modified.