Skip to main content

Custom Display Name

Overrides name

This option overrides the name of the instance. Therefore, this option should not be combined with a functional name fieldFieldA property of a DataElement expanded to a database column and user interface input element..

Option
hasDisplayName DataElement

This option is used to add a DisplayName to a DataElement, which is shown to users rather than the default display name. The default display name will show either the value of the name fieldFieldA property of a DataElement expanded to a database column and user interface input element. if that fieldFieldA property of a DataElement expanded to a database column and user interface input element. was added to the element or a generated name based on the database identifier.

A value must be given for the display name option. This value can be formatted to include the values of one or more fieldsFieldA property of a DataElement expanded to a database column and user interface input element., which will be separated by colons when displayed. The fieldFieldA property of a DataElement expanded to a database column and user interface input element. names in the option value should be separated by underscores.

<options>
<hasDisplayName>user_role</hasDisplayName>
</options>
Example

Given the following database record for a data elementData Element (DataElement). A fundamental data concept or entity within an application's domain, acting as an anthropomorphic translation of a real-life object or concept.:

userrole
Freddyadmin

The following display names can be expected:

Option valueDisplay name
userFreddy
user_roleFreddy:admin

Other Formats​

This option does not provide any syntax for formatting, other than including one or more other fieldsFieldA property of a DataElement expanded to a database column and user interface input element. in the display name. If a more customized display name is required, it is possible to implement the getCustomDisplayName() method in the CRUDS class of the data elementData Element (DataElement). A fundamental data concept or entity within an application's domain, acting as an anthropomorphic translation of a real-life object or concept..

private Option<String> getCustomDisplayName(ParameterContext<ExampleData> dataParameter) {
Option<String> result = none();

/* return some(string), to override default displayName */
// anchor:custom-displayName:start

// <== Insert your custom display name code here.
// Assign to result as in the following example:
result = some("Example display name");

// anchor:custom-displayName:end
return result;
}