Displaying list of chvs in an XLSForm

I have a form which sits at the supervisor contact profile and in that form, I would like to display a multi-select list of CHVs under that particular supervisor.

I am accessing this form while logged in as a supervisor.

How can I achieve this in CHT? I am looking for an example to guide me through this scenario.

Sorry, I am unaware of any way to support allowing a multi-select list of CHVs.

However, we can have a dropdown list of contacts (people/places) from where we can select one.

For example, if we want a list of places under the supervisor with type clinic, we can use type: db_clinic with appearance: db-object:
image

The form now looks like this:

Once selected, the chw_area field will hold the uuid of the place. The hidden field name will be automatically populated to store the name of the place.

image

We generally have single contact type person for people at all levels, so if we use db:person, we will get the list of all people within the supervisor’s place, including the supervisor.

If you have specified a different contact type for just CHVs, you can use that to get the list of CHVs.

1 Like

Hey @iesmail that functionality is not currently supported, as mentioned above. I gather that what you want to achieve is to dynamically pre-load CHVs data into the form.

A possible static workaround you could attempt to achieve that is by using pulldata(), supported via XPath. It is static because you define the .csv the same way you do other media support files and would have to be manually updated with the details of the CHVs. However, this comes with other challenges such choice filtering since data does not physically exist in the form, among others.

An easier similar approach would be to define the choice list of CHVs in the choices worksheet.

I would suggest the select_one approach explained in the comment above and work around the multiple aspect using supported functionality like repeats.

2 Likes

@binod, is there a way to store the names instead of ids in couch?

If your form is similar to the image above, the name should also be saved with this field: type:hidden, name:name.