Directories - Value of a field
- What is it? This calculation will search for a record in a Jadu Directory where the specified field matches the provided value. The calculation will then return the value of the specified directory field if a matching record is found, or "not-found" otherwise.
Setup
The formula relies on Jadu Directories. Therefore, it is necessary to have created a directory, and to have created one or more records in it, in order to be able to use this calculation successfully.
Inputs
This formula requires 4 inputs to be passed through to it:
-
The directory to search
All directories created in Jadu Central will be shown as choices for this input.
-
The field to match
The directory field to match against. When a directory is selected in the first input, a list of the fields in the directory will be available to choose from. Note that map, image and HTML fields cannot be used, and are therefore not shown.
-
The value to match
This can be mapped to a form response, logic formula, variable or manual text.
-
The field to return
The field from the directory to return. When a directory is selected in the first input, a list of the fields in the directory will be available to choose from. Note that map, image and HTML fields cannot be used, and are therefore not shown.
Return values
| Value | Description |
|---|---|
| The value of the specified return field | If a matching record is found in the directory |
| not-found | If there is no record matching the field and value provided |
Note: return values are case sensitive
Formula Logic
-
The database is queried, to find any entries into the field specified by the field to match input, where the value of the entry matches the value to match input.
-
If one or more values are found, the id of the record that this entry relates to is stored.
-
The database is queried, to find any entries into the field specified by the field to return input for the record matching the id stored in step 2.
-
If one or more entries are found, the result of the formula will be the value of the first entry.
-
If no matching entries are found at step 2 or 4, the result of the formula is 'not-found'.