Data Graphs allows you to generate a concept’s label automatically from other properties, which can save time when it needs to follow a pattern, eg:
{user.name} - {customType.label} - {date}
Enabling label auto-generation
To enable this feature, select the relevant Concept in the Domain Model editor and turn on the Auto Generate switch on its label property:
With the toggle turned on, the Auto Generate input will appear:
Enter a pattern here that describes how to formulate the label, and save the model. Now when you create a Concept and populate the fields referenced in the pattern, the label will populate at the same time.
Label auto-generation patterns
There are various ways to use patterns to generate a Concept’s label using curly bracket syntax.
1) Simple property
The simplest way is to use the value of a property and some text, eg:
This is a {property1} concept
The value can be a text, number or time datatype. There is no limit to the number of property references you can use.
2) Nested or related property
You can do the same thing with a nested or related property, perhaps a user field of type User which has firstName and lastName properties. In this case:
This is {user.firstName} {user.lastName}’s concept
Note: auto-generating labels only works on one level of nesting.
3) Excel formulas
Data Graphs uses Excel-type formulas that allow you to generate labels from logical expressions.
The formulas available are:
CONCATENATE
IF
SUM
TEXTJOIN
ISBLANK
Formulas should appear in an expression within double curly brackets. Property names still appear within single brackets.
Examples:
{{CONCATENATE({firstName}," ",{lastName})}}
Joins the values together, in this case the names are separated by a space.
{{TEXTJOIN(", ",true,{prop1})}}
Uses the delimiter in the first argument to join an array passed as the third argument. The second argument determines whether to ignore empty values.
{{IF({prop1}, {prop2}, {prop3})}}
Uses the value of the first to determine the value returned. In this case if prop1 is true, prop2 is returned. If it is false, prop3 is returned.
{{IF(ISBLANK({prop1}),{prop2},{prop3})}}
In this case using ISBLANK
creates the boolean required for the first argument of the IF statement.
{{SUM({prop1},{prop2},{prop3})}}
Adds arguments that are integers and/or decimals.