How to write Name Formulas
Name formulas come in very handy when you would like to automatically create names, which contain information entered in the Case Manager, for ontology instances or cases.

What are Name Formulas?

In Atfinity, the name of e.g. a case or downloaded document are provided automatically by default. Here you see an example of of default names in the ‘Cases’ overview.
Name Formulars can fill out Case Names for you
However, you have the option to write a name formula which determines how a name should look like, depending on the information entered in the case manager. In our example, the case name of an account opening could include the name of the account holder.
Name Formulas can fill out Instance Names for you
Where and how you can write name formulas for cases, ontologies, proof and document files is described in the following.

Case names

In the Configuration menu, select ‘Processes’ and click on the process where you want to write the name formula. This will define what name a case of this process will have in the ‘Cases’ overview.
In the ‘General’ tab, you can write the formula into the ‘Name Formula’ field.

Instance names

In the Configuration menu, select ‘Ontologies’ and click on the ontology where you would like to define the name formula. This will define how an instance of this ontology will be named.
In the ‘General’ tab the formula can be written in the ‘Name Formula’ field.
An instance of this ontology can only refer to information about itself. Therefore the reference self is used to write formulas. For example, a name formula for the ontology ‘Person’ could be self.full_name where self will refer to an instance of the ontology ‘Person’ and full_name refers to an information about this instance.

Examples

Here are some examples of name formulas:
OUTCOME_INSTANCE.contract_number
This formula could be used for naming cases.
OUTCOME_INSTANCE refers to the outcome ontology of e.g. a case, in this example a contractual Relationship, and contract_number refers to the information ‘contract_number’ of the specific instance created during the case. This formula is useful if the information you would like to access is of the same ontology as the outcome ontology of the process.
get_properties_from_instances(instances(Person), first_name)
This formula is used if you would like to name a case depending on information about instances which are not of the outcome ontology of the process. In this example the formula would return a list of the first names of all persons in a case.
The first argument is always an ontology, the second argument is the information you would like to extract. get_properties_from_instances will then extract the values of the specified information from all instances of the specified ontology. The resulting values are returned as a list and can be passed to different functions, for example SUM, AVG, JOIN or CONCAT.
Note that get_properties_from_instances is equal to get_properties. For more information see get_properties.
JOIN(
[
"Contract Nr.",
OUTCOME_INSTANCE.contract_number,
JOIN(
get_properties(instances(AccountHolder), full_name),
(
switch OUTCOME_INSTANCE.account_type
when joint_account then " a/o "
else ""
end
)
)
]," - "
)
This formula is used in a process with the outcome ontology “ContractualRelationship”. It results in all cases being named as follows: “Contract Nr.”, then the actual contract number and the names of all account holders in a contractual relationship. All the elements will be separated with a white space (“ “). If there are several account holders(e.g. in a joint account), the switch statement will take care of it. So an example output of this formula could be:
Contract Nr. - 123456 - Sparrow, Jack a/o Turner, William
OUTCOME_INSTANCE.account_name
Another possibility to define a name formula in a process is by writing it in a calculated information with the same outcome ontology as the process. In the process itself, you then just need to refer to the information, in this example account_name. This can be sometimes easier and very helpful if you reuse the formula often.
The formula used in the calculated information could look like this:
JOIN(
[
"Contract Nr.",
self.contract_number,
JOIN(
get_properties(instances(AccountHolder), full_name),
(
switch self.account_type
when joint_account then " a/o "
else ""
end
)
)
]," - "
)
When comparing this formula to the one used in example 3. you will notice that it looks very similar. It also would have the same output. However, there is a tiny difference. Since the calculated information is of the same ontology as the outcome ontology of the process, you need to replace OUTCOME_INSTANCE with self.