How to use a database field in an If/Then equation
Want to be able to use a database field as the logic in an IF/Then statement?
Databases are stored as the database name AND a unique database ID number. If you are using a database field in a calculation you need to split out the database ID
The image here shows how a database field appears as an output in a Text equation.
To use a Database field in an if/then equation you first need to take just the name of the field by using a "split" function
The example here shows that you can get the name by splitting after the "|".
e.g. splitlast(Database, "|")
To use the database result as part of an If/Then calculation just ensure you write your equation correctly
e.g If (splitlast(Activity, "|")= "Hills", Load, -1)
This means the calculation will firstly split the database result from the Activity field. Then, if the database field is called "Hills", it will return the duration entered into the Load field (as shown in the image below), otherwise it will return 0.
The image here shows the calculations returning the correct value based on a database field being used in the calculation