Integer
Integer questions आपके survey में whole number inputs की अनुमति देते हैं।
XLSForms और rtSurvey में integer question type का उपयोग whole number responses एकत्र करने के लिए किया जाता है। यह question type decimal places के बिना numerical data gather करने के लिए आवश्यक है, जैसे counts, ages, या years।
Basic XLSForm Specification
| type | name | label |
|---|---|---|
| integer | age | अपनी आयु वर्षों में दर्ज करें |
Basic integer question type के बारे में अधिक जानकारी के लिए, XLSForm specification देखें।
उपयोग
Integer questions सामान्यतः इनके लिए उपयोग किए जाते हैं:
- आयु inputs
- Items count करना (जैसे बच्चों की संख्या, household members)
- Year inputs (जैसे जन्म का वर्ष)
- Numerical scale पर ratings
- कोई भी whole number data collection
rtSurvey Extensions
Basic XLSForm specification के अतिरिक्त, rtSurvey अतिरिक्त सुविधाएं प्रदान कर सकता है:
- Range validation
- Custom error messages
- Number input के लिए appearance options
Best Practices
- Expected input निर्दिष्ट करने के लिए clear और concise labels का उपयोग करें।
- Unrealistic या erroneous inputs को रोकने के लिए range constraints लागू करें।
- Expected format को स्पष्ट करने या उदाहरण प्रदान करने के लिए hint text का उपयोग करने पर विचार करें।
- बड़ी संख्याओं के लिए, readability में सुधार करने के लिए label में commas या spaces का उपयोग करने पर विचार करें।
Constraints और Validation
आप यह सुनिश्चित करने के लिए constraints जोड़ सकते हैं कि दर्ज किया गया मूल्य एक specific range में हो:
| type | name | label | constraint | constraint_message |
|---|---|---|---|---|
| integer | age | अपनी आयु वर्षों में दर्ज करें | .>0 and .<=120 | आयु 1 और 120 वर्ष के बीच होनी चाहिए |
Example Usage
यहाँ बताया गया है कि आप household survey में integer questions का उपयोग कैसे कर सकते हैं:
| type | name | label | constraint | constraint_message |
|---|---|---|---|---|
| integer | household_size | आपके घर में कितने लोग रहते हैं? | .>0 | Household size कम से कम 1 होनी चाहिए |
| integer | num_children | Household में 18 से कम आयु के कितने बच्चे हैं? | .>=0 | बच्चों की संख्या negative नहीं हो सकती |
| integer | year_built | आपका घर किस वर्ष बना था? | .>1800 and .<=2023 | वर्ष 1800 और 2023 के बीच होना चाहिए |
Integer Values के साथ Calculation
Integer values का उपयोग calculations में किया जा सकता है। यहाँ एक उदाहरण है:
| type | name | label |
|---|---|---|
| integer | num_adults | Household में adults की संख्या |
| integer | num_children | Household में बच्चों की संख्या |
| calculate | total_members |
calculate row में, आप इसका उपयोग कर सकते हैं:
calculation | ${num_adults} + ${num_children}
यह total household members प्राप्त करने के लिए adults और children की संख्या को जोड़ देगा।