diff --git a/_includes/header.html b/_includes/header.html index 3133199..f00e673 100644 --- a/_includes/header.html +++ b/_includes/header.html @@ -16,6 +16,7 @@ c0-0.82,0.665-1.484,1.484-1.484h15.031C17.335,12.031,18,12.696,18,13.516L18,13.516z"/> + FAQs
{% for page in site.pages %} {{ page.title }} diff --git a/_includes/xlsform.md b/_includes/xlsform.md index 0e0d177..0f60b31 100644 --- a/_includes/xlsform.md +++ b/_includes/xlsform.md @@ -426,6 +426,8 @@ Some platforms also support dynamic repeat counts. In the example below, the nu | | male_female | male | Male | | | | male_female | female | Female | | +Note like normal [groups](#nesting), repeat groups can be nested, which means putting a repeat group inside another repeat group, the [homestead](https://docs.google.com/spreadsheets/d/1WcFC_VUAhyUviOO1AJ33E25hcE-jftfn9x5sMrs4Sa8/edit?usp=sharing) XLSForm is used as an example to show how nested repeats work. + ### Multiple language support diff --git a/_layouts/post.html b/_layouts/post.html index 838ad7a..7cc8165 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -1,7 +1,7 @@ --- layout: default --- -
+

{{ page.title }}

diff --git a/content/screenshots/faq/cascades-with-choice-filter-1.png b/content/screenshots/faq/cascades-with-choice-filter-1.png new file mode 100644 index 0000000..29f2348 Binary files /dev/null and b/content/screenshots/faq/cascades-with-choice-filter-1.png differ diff --git a/content/screenshots/faq/faq-count-selected.png b/content/screenshots/faq/faq-count-selected.png new file mode 100644 index 0000000..4d4df2f Binary files /dev/null and b/content/screenshots/faq/faq-count-selected.png differ diff --git a/css/main.css b/css/main.css index 0f1258b..2b01dc0 100644 --- a/css/main.css +++ b/css/main.css @@ -54,8 +54,9 @@ table tr th, table tr td{ /* Utility */ .container{ + clear: both; max-width: 960px; - margin: 0 auto; + margin: 0 auto!important; } .wrap{ diff --git a/faqs/_posts/2016-02-04-using-count-selected-function.md b/faqs/_posts/2016-02-04-using-count-selected-function.md new file mode 100644 index 0000000..22ccb46 --- /dev/null +++ b/faqs/_posts/2016-02-04-using-count-selected-function.md @@ -0,0 +1,39 @@ +--- +layout: post +title: "How do I use the count-selected() function?" +permalink: /faq/using-count-selected-function +category: faq +--- + +The **count-selected** function is used with select_multiple questions. It will count the number of answer choices selected in the select_multiple question and return that value as an integer. See the example below: + +| survey | | | | | +| ------------- | --------------------------- | ---------------- |--------------------------------------------| --------------------------------| +| | type | name | label | calculation | +| | select_multiple cities | cities_visited | Select all of the cities you have visited. | | +| | calculate | num_cities_visited | |count-selected(${cities_visited})| + + + +A much more practical application of count-selected is to restrict a user from selecting certain answer choices together. Take the following question as an example: + +

+![](/content/screenshots/faq/faq-count-selected.png) + +In this question, one of the options is **No risk symptoms observed**. It wouldn’t make any sense for a user to select other risk symptoms and then also select No risk symptoms observed. Using the count-selected function, you can restrict the user from selecting **No risk symptoms** observed with any other answer choice. See the XLSForm snippet below: + +| survey | | | | | +| ------------- | --------------------- | --------------- | ------------------- | ---- | +| | type | name | label | constraint | +| | select_multiple risks | risks_observed | Does the woman have any risk symptoms? | (selected(., 'none') and (count-selected(.) = 1)) or not(selected(., 'none')) | +|**choices** | | | | | +| | list name | name | label | | +| | risks | pallor | Pallor | | +| | risks | swelling | Swelling / Edema | | +| | risks | bleeding | Bleeding | | +| | risks | jaundice | Jaundice | | +| | risks | convulsions | Fits / Convulsions | | +| | risks | none | No risk symptoms observed | | +| | risks | others | Others | | + +The constraint logic is specifying that if the user selects the answer choice name **none**, then only this answer can be selected (count-selected(.) = 1), or answer choice name **none** is not selected at all. diff --git a/faqs/_posts/2016-02-05-choice-filter-for-cascades-selects.md b/faqs/_posts/2016-02-05-choice-filter-for-cascades-selects.md new file mode 100644 index 0000000..f19e7bb --- /dev/null +++ b/faqs/_posts/2016-02-05-choice-filter-for-cascades-selects.md @@ -0,0 +1,25 @@ +--- +layout: post +title: "How do I use choice filter for cascade selects?" +permalink: /faq/choice-filter-for-cascades-selects +category: faq +--- + +In order to create [cascade selects](http://xlsform.org/#cascade)in your form, add the **choice_filter** column in the **survey** worksheet, which will filter the lists of the multiple choice questions. The choice filter you specify in the **choice_filter** column defines which prior field will be used to filter the list of options. For instance, with a location hierarchy, the choice filter will be written as follows: + +| survey | | | | | +| ------------- | ------------------- | --------------|--------------------------------------------| --------------------------------| +| | type | name | label | choice_filter | +| | select_one province | hh_province | Province in which the household is located | | +| | select_one district | hh_district | District in the province where the household is located |cf=${province}| +| | select_one village | hh_village | Village of the household in the district |cf=${hh_district}| + + +**cf=${province}** filters the list of districts to the province that was selected and **cf=${district}** filters the list of locations to the district that was selected. + +In the **choices** worksheet, add the province, district, and location answer choices as you normally would and add a new column called **cf**; this column allows you to specify the location filters. + +![](/content/screenshots/faq/cascades-with-choice-filter-1.png) + +Check out the entire XLSForm example [here](https://docs.google.com/spreadsheets/d/1_Pu8jH25jfNBnmK5-524nyEemzGbRuwb-6CPuJqM7mQ/edit?usp=sharing). + diff --git a/faqs/_posts/2016-02-05-indexed-repeats.md b/faqs/_posts/2016-02-05-indexed-repeats.md new file mode 100644 index 0000000..4def38b --- /dev/null +++ b/faqs/_posts/2016-02-05-indexed-repeats.md @@ -0,0 +1,37 @@ +--- +layout: post +title: "How does an indexed repeat work?" +permalink: /faq/indexed-repeats +category: faq +--- + +An indexed repeat allows a user to reference information from a previous repeat group and use it in a subsequent repeat group. For example, if you’re collecting information on members of a household, you might start with one repeat group that collects the household members’ names and basic demographic information while later on in the form, you might want to use a new repeat group that collects additional information such as income for each household member. + +In the example below, the **hh_member_names_repeat** repeat group is used to record the name of each household member. Note the use of the [repeat_count](http://xlsform.org/#repeats) function that restricts the number of repeats to the number of household members entered in the first question. The **position(..)** function assigns a sequential value (i.e., 1, 2, 3, ...) for each household member. + +| survey | | | | | | +| ------------- | ------------- | ------------ | -------------------------------- |------- ---- |----------------- | +| | type | name | label | calculation |repeat_count | +| | integer | num_hh_members | How many people live in this household? | | +| | begin repeat | hh_member_names_repeat| Household member names | |${num_hh_members} | +| | calculate | name_number | | position(..) | | +| | text | hh_member_name | Name of household member #${name_number}?| | | +| | end repeat | | | | | | + +In a subsequent repeat group, you can ask for additional information about the household members, such as age and sex, using their names that were entered in the first repeat group. Use the expression **indexed-repeat(${name_hh_member}, ${hh_member_names_repeat}, position(..))** to return the names of the household members in the order they were added in the first repeat group. See the example below: + + +| survey | | | | | +| ------------- | ------------ | --------------------- |------------------------------| --------------------------------| +| | type | name | label | calculation | +| | begin repeat | hh_member_info_repeat | Household member age and sex | | +| | calculate | name_from_earlier | | indexed-repeat(${hh_member_name}, ${hh_member_names_repeat}, position(..))| +| | integer | hh_member_age | Age of ${name_from_earlier} | | +| | select_one sex | hh_member_sex | Sex of ${name_from_earlier} | | +| | end repeat | | | || + +The [Baseline Household Survey](https://docs.google.com/spreadsheets/d/1313vcNIxM1mXfjgC4noYmg-vMSIrS1Bu0wO7arYevOw/edit?usp=sharing) is an XLSForm with an example indexed repeat function. + + + + diff --git a/faqs/index.html b/faqs/index.html new file mode 100644 index 0000000..f82a938 --- /dev/null +++ b/faqs/index.html @@ -0,0 +1,12 @@ +--- +layout: page +--- +
+

FAQs

+ {% for posts in site.categories.faq %} + + + {% endfor %} +
\ No newline at end of file