Dear community,
I want to check if an entity attribute column contains a value.
So I basically have a text field where the user enters an account number, and then a subsequent calculate field to search through the same_outlet_acc column of the entity list (which is supposed to contain string of some options [accounts] selected through multiple-select question at entity creation) to see if any field in that column contains the account number entered in the text field.
Is my calculation correct? Because it returns nothing instead of 'yes' or 'no' and I'm not able to figure it out. if(count(instance('visited_agents')/root/item[contains(same_outlet_acc, ${acc_number})]/same_outlet_acc) > 0, 'yes', 'no')
I would recommend using selected instead of contains for the reasons described in this thread but I also tried contains and that worked as expected.
The trigger column expression isn't required in this case because your calculation is hidden. It's only needed to do a dynamic default that a user could edit. But again, it shouldn't be an issue and I've confirmed that it works for me with the trigger expression.
I think you're going to need to share more about your form and your Entity List if you're still stuck on this. Are you submitting with Collect or Enketo?