Select_multiple
Select_multiple questions उत्तरदाताओं को predefined list से एक या अधिक विकल्प चुनने देते हैं।
select_multiple question type एक list प्रदर्शित करता है जहाँ उत्तरदाता एक या अधिक विकल्प चुन सकता है। Default रूप से choices checkboxes के रूप में render होती हैं। Stored value सभी selected choice values की space-separated list है।
Basic XLSForm Specification
survey worksheet:
| type | name | label |
|---|---|---|
| select_multiple crops | crops_grown | Household किन crops को उगाता है? |
choices worksheet:
| list_name | name | label |
|---|---|---|
| crops | maize | Maize |
| crops | beans | Beans |
| crops | rice | Rice |
| crops | vegetables | सब्जियाँ |
| crops | other | अन्य |
अधिक जानकारी के लिए XLSForm specification देखें।
Stored data format
Exported column selected values की space-separated list contains करता है:
maize beans vegetables
Expressions में select_multiple values test करते समय = के बजाय selected() function का उपयोग करें (नीचे देखें)।
उपयोग
Select_multiple questions का उपयोग इनके लिए किया जाता है:
- Multiple applicable answers एकत्र करना (जैसे income के sources, उगाए गए crops, symptoms)
- Checkbox-style agreement items (जैसे “Select all that apply”)
- Language या skill inventories
- कोई भी प्रश्न जहाँ multiple answers एक साथ valid हों
Appearance options
| Appearance | विवरण |
|---|---|
| (none) | Default checkboxes, प्रति line एक |
minimal | Dropdown multi-select widget |
compact | Compact grid, columns screen width के अनुसार adjust होते हैं |
compact-N | N columns पर forced Compact grid |
horizontal | Horizontal row में arranged Choices (web) |
horizontal-compact | Horizontal, compact spacing (web) |
label | केवल labels दिखाता है, कोई checkboxes नहीं (list-nolabel के साथ उपयोग करें) |
list-nolabel | केवल checkboxes दिखाता है, कोई labels नहीं (label के साथ उपयोग करें) |
columns(N) | N columns में प्रदर्शित करें (rtSurvey extension) |
उदाहरण: 3-column compact layout
| type | name | label | appearance |
|---|---|---|---|
| select_multiple symptoms | symptoms | सभी observed symptoms चुनें | compact-3 |
Expressions में selected() का उपयोग करना
क्योंकि stored value एक space-separated string है, आपको selected() का उपयोग करना होगा यह test करने के लिए कि कोई specific choice pick की गई थी। = का उपयोग करने से सही ढंग से काम नहीं होगा।
relevant में
केवल तभी follow-up question दिखाएं जब “other” चुना गया हो:
| type | name | label | relevant |
|---|---|---|---|
| select_multiple crops | crops_grown | कौन से crops उगाए जाते हैं? | |
| text | crops_other | कृपया अन्य crops निर्दिष्ट करें | selected(${crops_grown}, 'other') |
constraint में
कम से कम 2 choices की आवश्यकता करें:
| type | name | constraint | constraint_message |
|---|---|---|---|
| select_multiple issues | issues | count-selected(.) >= 2 | कम से कम 2 issues चुनें |
अधिकतम 3 तक सीमित करें:
| type | name | constraint | constraint_message |
|---|---|---|---|
| select_multiple priorities | priorities | count-selected(.) <= 3 | अधिकतम 3 priorities चुनें |
calculate में — selected labels को join करना
पठनीय summary build करने के लिए selected-at(), count-selected(), और choice-label() को combine करें:
| type | name | calculation |
|---|---|---|
| calculate | crops_summary | join(’, ‘, ${crops_grown}) |
“None of the above” / exclusive विकल्प
एक सामान्य pattern एक विकल्प को सभी अन्य विकल्पों के साथ mutually exclusive बनाना है। इसे enforce करने के लिए constraint का उपयोग करें:
| type | name | label | constraint | constraint_message |
|---|---|---|---|---|
| select_multiple issues | issues | सभी present issues चुनें | not(selected(., 'none') and count-selected(.) > 1) | “None” को अन्य विकल्पों के साथ नहीं चुना जा सकता |
choices:
| list_name | name | label |
|---|---|---|
| issues | water | पानी की कमी |
| issues | roads | खराब सड़कें |
| issues | health | स्वास्थ्य सेवाओं का अभाव |
| issues | none | इनमें से कोई नहीं |
Selections की गिनती और summarising
| Function | Example | Result |
|---|---|---|
count-selected(field) | count-selected(${crops_grown}) | चुनी गई choices की संख्या |
selected(field, value) | selected(${crops_grown}, 'maize') | true/false |
selected-at(field, index) | selected-at(${crops_grown}, 0) | पहली selected value |
choice-label(field, value) | choice-label(${crops_grown}, 'maize') | एक value के लिए label |
Best Practices
relevant,constraint, औरcalculateमें हमेशाselected()का उपयोग करें — कभी=या!=का नहीं।- यदि question design की आवश्यकता हो तो selections की maximum संख्या सीमित करने के लिए constraint जोड़ें।
- “None” या “Not applicable” विकल्प शामिल करें जब zero selections एक valid उत्तर हो।
- लंबी lists (15+ choices) के लिए, अत्यधिक scrolling से बचने के लिए
minimal(multi-select dropdown) का उपयोग करें। - Data export करें और अपने analysis tool में string-splitting का उपयोग करें।
सीमाएं
- Select_multiple values को
=से directly compare नहीं किया जा सकता। हमेशाselected()का उपयोग करें। - Compact appearance बहुत लंबे choice labels के लिए अच्छी तरह render नहीं हो सकती।
choice_filterके साथ choices filter करते समय, filtering सभी displayed choices पर apply होती है, वैसे ही जैसेselect_oneमें।