Blank values compare differently to non-relevant nodes in Collect and Enketo

I am creating an frm but when we check that form into the browser then the mapping is showing correctly but when I try to fill the form through QR code then in the application it is showing multiple option at the same question at question number 10 there is the issue. I am attaching my excel file and my issue screenshot also
LAP.xlsx (59.0 KB)


I believe that a non-relevant field is treated as different from an empty value in Enketo but as the same in Collect. I believe the Enketo behavior is technically correct -- this is similar to a recent conversation about using whether or not a field has a value in relevance expressions.

Could you simplify the form structure by using a single column for all activities in your choice lists? It's the blank values that are treated inconsistently and I think they also make the form harder to understand. I'd suggest having a single column to represent your activities.

Here's what that might look like: LAP-HM-simplification.xlsx (57.8 KB)

I am not entirely sure but it looks to me like you're trying to look up a single value. If so, you don't have to ask the user to select it, you can use a calculate to compute that value.

For the MGNREGA question:
instance('si_no_as_per_266_persisibble_work_of_mgnrega')/root/item[activity=${activity}]/name

For the NRM question:
instance('nrm_agri_allied_infra')/root/item[activity=${activity}/name

There's more information about how to look up values this way in the XLSForm template and in the documentation.

Currently it looks like all of the values for the nrm_agri_allied_infra list are the same, so you may not need it at all (maybe this is just a work in progress, though!).

You may have reasons to want the user to see and explicitly select those values so only use my suggestions if they make sense for your context!

Thanks for your help but its not working as some of the context is not showing for in the form as if you select construction_of_cattle_shelter_for_individuals then the si_no_as_per_266_persisibble_work_of_mgnrega and nrm_agri_allied_infra is not showing in the form from the excel given by you

Hi everyone here is another excel in which i am facing the same issue please suggest any help fpr both of the excel
LUP.xlsx (68.0 KB)

My apologies, I wrote the coalesce expression for calculating the activity backwards. I believe it should be:

coalesce(${construction_of_goat_shelter_for_individuals}, coalesce(${construction_of_poultry_livestock_shelter_for_individuals}, coalesce(${construction_of_cattle_shelter_for_individuals}, ${plan_individual_activity_schemes})))

If you haven't already found another way to address your issue, please give that a try and see if it does what you expect.

The coalesce function takes two values and returns the first one that is not blank. In your form, you have a first select that lets the user pick a general activity type. Then you have some follow-up selects to get more specific for some activity types. What we want to do is use the more specific activity types if they are available and fall back on the general activity type. I believe that this new expression should do that.

I took a quick look at your Land Use Planning form. Another option that might work for both forms is to fill out a placeholder value for cells in the grid that don't need values. For example, I used n/a at LUP-HM-edit.xlsx (67.9 KB)

I won't have time to dig deeper into the logic of the form but I did notice at least once significant issue. Questions 2.a and other similar subquestions used the value of their own field as part of the choice filter which will not give expected results. Every time the selected value changes, the filter will change. I don't think you want that part of the choice filter at all.

With this form again, it looks to me like you'd like to be able to look up values in a table. For example, when the user selects hillock, you want to know that the slope is "above 25%." Here's a quick example of how to do that: lookup_table.xlsx (10.7 KB)

You can continue what you're doing and use selects to get the values but I wanted to make sure you know that this is an alternative that would work for many of your questions. You can learn more in the documentation.