=== Calculated Fields ===__NOEDITSECTION__
The '''Calculated Fields''' section allows the specification of new fields derived from existing ones. For example, arithmetic operators can be applied to existing fields, e.g. multiplying, dividing, adding or subtracting two or more numeric values. An '''if-then-else logic can also be implemented, such as in the following example expression:
<pre>
if (public_accident.sourcereliabilityenum == null, 'Unknown', public_accident.sourcereliabilityenum)
</pre>
This expression acts like a CASE statement on the database: if there is no value for the attribute sourcereliabilityenum, then the string ''Unknown'' is displayed, otherwise (i.e. if there is a value), that value is taken into account. Such a manipulation can be required in the following use cases for example:
* Eliminating null values (such as in the example above)
* Grouping categories together (e.g. the values ''Agriculture'' and ''Agricultural'' of a single-value attribute, if they have the same meaning)
{{Note|Take into consideration that there are several steps in the process where such manipulations can be made:
* At the source, i.e. inside the IMSMA database: this fixes the problem at the source and is the best option
* In a database view: create a view on the database managing e.g. elimination of null values, grouping of categories, etc.
* Using derived tables when designing a MINT domain (use SQL)
* Using calculated fields
The choice of the method depends on the requirements, the urgency, timeline, etc. It is important to be consistent though and document where each manipulation is implemented.}}
[[File:MINT_domain_designer_calculated_fields.png|center|900px]]