# Risk Name Template

Risk name templates are templates that can be used to give a risk a more human-readable name. For instance, instead of a risk being called Vehicle 1, they'll be called 2013 Hyundai Elantra.

You can define a risk name template by clicking on pencil icon next to Risk Type name on Risk Type details page.

Default template is set to:

{{ riskType.label }} {{ number }}
1

Where riskType hold the information regarding the Risk Type and number is the risk number. An autocomplete is available for your convenience.

Variables look like this: {{ variable }}. When the system encounters a variable, it evaluates that variable and replaces it with the result. Variable names are basically names of the data fields of Risk Type:

{{ riskType.label }} {{ make }} {{ modelYear }}
1

In the above example, {{ riskType.label }} will be replaced with the label attribute of the riskType object. make and modelYear data fields variables will be replaced by the provided answer value.

If you use a variable that doesn’t exist, the system will fall back to use default template {{ riskType.label }} {{ number }}.

# Optional Variable

Variables in templates can also be marked as optional, in this case the system will evaluate the variable and if a result is not found the variable will be skipped and the system will continue to evaluate the other variables.

# Examples

{{ firstName}} {{ middleName|optional }} {{ lastName }}
1

In the above template middleName is optional which means that if its value is not available, the system will generate the risk name using provided values for firstName and lastName, if value for firstName or lastName is not available then it will fall back to use the default risk name template {{ riskType.label }} {{ number }}.

# Example 1

If the field values are:

  • firstName: Robert
  • lastName: Will

The risk name will be generated as: Robert Will.

# Example 2

If the field values are:

  • firstName: Robert
  • middleName: M.
  • lastName: Will

The risk name will be generated as: Robert M. Will.

# Example 3

If the field values are:

  • firstName: Robert
  • middleName: M.

The risk name will be generated using default template {{ riskType.label }} {{ number }} since lastName is not available.

# Multiple Spaces

Multiple spaces in a risk name template will be stripped to a single space character.

# Example

{{ firstName }}    {{ lastName }}
1

If the field values are:

  • firstName: Robert
  • lastName: Will

The risk name will be generated as: Robert Will.