Create Fields For a Layout
You can create fields in a Layout if you'd like to use a field that isn't defined in your Oracle Cloud Application. You can set the fields to variables, or to expressions that reference other fields available in the Layout.
Note:
Creating a field in VB Studio doesn't create a field in your Oracle Cloud Application. You need to use App Composer to create custom fields in your Oracle Cloud Application. For details, see Add Objects and Fields in Configuring Applications Using Application Composer.You can't create or modify the fields in your Oracle Cloud Application, or the service definition used by a Layout, but you can override some field properties, such as "Read Only" and "Required". So if a field's Required property is set to False in the service definition, you can override the property to make it more strict and set it to True. This won't change the description in the service definition, where the property will still be set to False. However, you can't override a property to make it less strict, meaning you can't set a Required property to False if it is already set to True in the service definition.
If the fields defined in the service definition don't meet your needs, you can create calculated fields and virtual fields. You would use a calculated field when you want to use an expression, set a default value, modify labels, and set Read-Only and Required properties. You would use a virtual field if you want a field that has editable sub-fields. To create a virtual field, see Create a Virtual Field below.
You can use a calculated field when you want to have a single field in your Layout that, for example, contains some static string or an expression that is computed from the values of other referenced fields or objects. Suppose your data source has separate fields for a user's first name and last name. You could create a calculated field that combines these fields into a single field called fullName
, and use that in your layouts instead. The value of this new field is calculated using an expression like [[ 'Name: ' + $fields.firstName.value() + $fields.lastName.value() ]]
. In a calculated field, referenced fields defined in the expression are read-only, so they can't be edited in a layout.
To create a calculated field:
Your custom fields (and any fields that you have modified, for example, in the Properties pane) are indicated by a blue dot to the right of the field name. In this screenshot, you can see the blue dot next to MemberOfDepartment
.
Create a Virtual Field
You might want to create a virtual field if you would like to combine multiple fields together into a single field that you can add to your rule set layouts. For example, you can create a single field that combines several contact details that are stored in different fields in your layout. A virtual field is similar to a calculated field, except:
- the referenced fields can be edited in the layout; and
- the virtual field is rendered using a field template.
When you add a virtual field to a layout, you'll need to define a field template to display it. You'll need to create the field template if it doesn't exist. The template will contain components for each of the referenced fields that you want to display in the layout.
To create a virtual field: