Right Code for Choice_filter on a multiple choice selected previously

Thank you very much for this choice_filter code. Unfortunately, it seem to select every option from the multiple choice once one selection is made. This is the formular used and i even substituted and with or but the same effect -selected(${program},name) or
not(selected(${program},‘freehci’) and (name=‘malaria’ or name=‘rhfp’ or name=‘nutrition’ or name=‘hivaids’ or name=‘tb’ or name=‘chw’))
and not(selected(${program},‘malaria’) and (name=‘freehci’ or name=‘rhfp’ or name=‘nutrition’ or name=‘hivaids’ or name=‘tb’ or name=‘chw’))
and not(selected(${program},‘rhfp’) and (name=‘malaria’ or name=‘freehci’ or name=‘nutrition’ or name=‘hivaids’ or name=‘tb’ or name=‘chw’))
and not(selected(${program},‘nutrition’) and (name=‘malaria’ or name=‘rhfp’ or name=‘freehci’ or name=‘hivaids’ or name=‘tb’ or name=‘chw’))
and not(selected(${program},‘hivaids’) and (name=‘malaria’ or name=‘rhfp’ or name=‘nutrition’ or name=‘freehci’ or name=‘tb’ or name=‘chw’))
and not(selected(${program},‘tb’) and (name=‘malaria’ or name=‘rhfp’ or name=‘nutrition’ or name=‘hivaids’ or name=‘freehci’ or name=‘chw’))
and not(selected(${program},‘chw’) and (name=‘malaria’ or name=‘rhfp’ or name=‘nutrition’ or name=‘hivaids’ or name=‘tb’ or name=‘freechi’))

I am developing a survey question on the supply of medical products
I have designed a question with multiple choice answers of the different existing programs - Free Health Care Initiative, Nutrition, Malaria, HIV/AIDS, TB/Leprosy, CHW, Reproductive Health and Family Planning, Cost Recovery and Integrated Care. There are different medical products supplied for these programs.

I have develop in the choice sheet, a line list of the different medication with their program as indicated below

list_name name label district program
item tld_30_tablets Tenofovir/Lamivudine/Dolutegravir 300/300/50mg (30 Tablets) hivaids
item tld_90_tablets Tenofovir/Lamivudine/Dolutegravir 300/300/50mg (90) hivaids
item abc_600mg_3tc_300mg Lamivudine/Abacavir 600/3000mg hivaids
item abc_120mg_3tc_60mg Lamivudine/Abacavir 60/120mg hivaids
item nevirapine_syrup Nevirapine susp 50mg/5ml, 100ml hivaids
item dtg_10mg Dolutegravir 10mg Tablet hivaids
item dtg_50mg Dolutegravir 50mg Tablet hivaids

Additionally, I have use this code in the choice selector for the selection of medical products foe each of the program - program=${program}. This works out perfectly.

The issue now is that there are time when two or more programs are combined in a single supply. I wanted a code that can display the medical products base only on the program selected.

I have used the code below but it tend to select all the medication whether selected or not. - selected(${program},name) or
not(selected(${program},‘freehci’) and (name=‘malaria’ or name=‘rhfp’ or name=‘nutrition’ or name=‘hivaids’ or name=‘tb’ or name=‘chw’))
and not(selected(${program},‘malaria’) and (name=‘freehci’ or name=‘rhfp’ or name=‘nutrition’ or name=‘hivaids’ or name=‘tb’ or name=‘chw’))
and not(selected(${program},‘rhfp’) and (name=‘malaria’ or name=‘freehci’ or name=‘nutrition’ or name=‘hivaids’ or name=‘tb’ or name=‘chw’))
and not(selected(${program},‘nutrition’) and (name=‘malaria’ or name=‘rhfp’ or name=‘freehci’ or name=‘hivaids’ or name=‘tb’ or name=‘chw’))
and not(selected(${program},‘hivaids’) and (name=‘malaria’ or name=‘rhfp’ or name=‘nutrition’ or name=‘freehci’ or name=‘tb’ or name=‘chw’))
and not(selected(${program},‘tb’) and (name=‘malaria’ or name=‘rhfp’ or name=‘nutrition’ or name=‘hivaids’ or name=‘freehci’ or name=‘chw’))
and not(selected(${program},‘chw’) and (name=‘malaria’ or name=‘rhfp’ or name=‘nutrition’ or name=‘hivaids’ or name=‘tb’ or name=‘freechi’))

Please community help!

Let us avoid, please, to post the same issue twice. See How do i use choice filters to select what has been selected in the previous question along with an additional none choice (in Q2)? - #11 by Badr_ben.

@samuelansu, you may need to share your XLSForm (only the relevant part) with the community. The community should help you solve your issue.

@Kalyan Lama from KoboToolbox

Thank you so much for your continued support.

Attached is the XLSForm containing only the information for the affected entries. What I would like is for the drugs to be uploaded in alignment with the selections made for each program.

Thank you once again.

Best regards,

Ansumana

(attachments)

NMSA_DISTRIBUTIONS2.xlsx (27.1 KB)