Skip to content

Commit

Permalink
Updated doc to include uniquePhone validation
Browse files Browse the repository at this point in the history
  • Loading branch information
PrjShrestha authored Aug 2, 2023
1 parent 57d6bac commit f72993e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions content/en/apps/reference/app-settings/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ matches "mary", "Mary", "john", "John", "JOhN", etc. Not "maryjohn"
| Function | Description |
|----|----|
| `unique(*fields)` | Returns `true` if no existing valid report has the same value for all of the listed fields. Fields are compared to those at the top level and within `fields` for every report doc. To include the form type use `'form'` as one of the fields. Eg `unique('form', 'patient_id')` checks that this form was never submitted for this patient. |
|`uniquePhone(phone_number field)`| Returns `true` if contact with the phone number already exists.|
| `uniqueWithin(*fields, time_period)` | Same as `unique` but the last argument is the time period in which to search. Eg `uniqueWithin('form', 'patient_id', '1 week')` checks that the same form wasn't submitted for this patient in the past week. |
| `exists(form_id, field)` | Returns `true` if a report matches the `form_id` and value for `field`. This is useful to check that a patient was registered for a service before reporting about it. Eg `exists('REG', 'patient_id')` checks that a `REG` form was already submitted for a patient. As of 2.12 most uses of this function are obsolete because checking for a valid `patient_id` is done automatically by the `accept_patient_report` transition using `registration_not_found` in the `messages.event_type`. |
| `isISOWeek(weekFieldName[, yearFieldName])` | Returns `true` if the current report has a week value that is less or equal to the number of ISO weeks of the current year or the year value of the same report. The first parameter is the field name for the week and the second parameter is the field name for the year: `isISOWeek('week', 'year')`. If the second parameter is not specified, then the current year is used: `isISOWeek('week')`. |
Expand Down

0 comments on commit f72993e

Please sign in to comment.