Hi @gkesh, to add to @diana’s comments, I noticed in your form image that you are using field names such as mother_case_name
, mother_case_age
and they also have calculations. Unless the mother contact has these exact fields in the root, it might not work.
According to the documentation: Input data available in forms
existing data in fields that are in the same group as the contact selector and share the same name as a field on the selected contact
It might not be very clear from the docs, but the field names need to match. After pulling a field using exact name, we can copy it to another field with a unique name to make it easier to use later.
Please see this example:
type | name | label::en | relevant | appearance | required | default | calculation |
---|---|---|---|---|---|---|---|
begin group | mother | field-list | |||||
string | mother_case_id | Select Mother | select-contact type-c82_person | ||||
hidden | name | ||||||
hidden | date_of_birth | ||||||
calculate | mother_case_name | …/name | |||||
calculate | mother_dob | …/date_of_birth | |||||
note | mother_info_display | * Mother’s Name: ${mother_case_name} * Mother’s DOB: ${mother_dob} |
|||||
end group |
Here we are pulling name
and date_of_birth
from the mother’s contact document, and copying them over to the calculated fields: mother_case_name
and mother_dob
.
You can also see the values of all the fields by running this command in the browser console:
window.CHTCore.debugFormModel
For this problem:
If the user can see a person with correct type (i.e. "type":"contact"
, "contact_type": "c82_person"
), they should be available in the list. Please check the mother’s document and make sure that the user has access to it. Also please note that the second approach (select-contact type-
) is supported from CHT versions 3.10.x onwards.
If it still does not work, we can look further.