Boolean
Within JSONata there are two types of Boolean expressions used to find out whether the result is true or false, namely:
Result | Expression |
(And) Does the array of data contain both a name and an image? | =$boolean(@ctx.datasources.employees.name and @ctx.datasources.employees.img) |
(Or) Does the array of data contain a phone number or email? | =$boolean(@ctx.datasources.employees.phoneNumber or @ctx.datasources.employees.email) |
(If value =) If the name of the employee is "Mary Gomez", set true | [email protected] = "Mary Gomez" ? true :false |
(If value <) If the age of an employee is smaller than 20 set true. | [email protected] < 20 ? true :false |
(If array >) Does the array of data contain more than two objects? | =$count(@ctx.datasources.employees) > 2 ? true :false |
This example evaluates static data in a component.enity to show the results in the entity field as a boolean.
See the full code sample in GitHub.
Example of writing a condition for a placeholder. If the number of objects in the array is greater than zero, the placeholder is not displayed. If it isn't and the field is empty, a placeholder will appear with the icon and the specified text.
See the full code sample in GitHub.
See tips and tricks when using placeholders for additional information.