DataOption hasDisplayName

This option is used to add a display name to a data element, which is shown to users rather than the default display name. The default display name will show either the value of the name field if that field 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 fields, which will be separated by colons when displayed. The field names in the option value should be separated by underscores.


Field values

Field name Value in DB record
fieldName1 Field1Value
fieldName2 5

Option results

Option value Display name
fieldName1 Field1Value
fieldName1_fieldName2 Field1Value:5


This option does not provide any syntax for formatting, other than including one or more other fields 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 element.

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;