Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SM: Added FAQ page #61

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
</svg>
</a>
<a href="/faqs" class="pull-right">FAQs</a>
<div class="trigger">
{% for page in site.pages %}
<a class="page-link" href="{{ page.url | prepend: site.baseurl }}">{{ page.title }}</a>
Expand Down
2 changes: 2 additions & 0 deletions _includes/xlsform.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


### <a name="language"></a>Multiple language support

Expand Down
2 changes: 1 addition & 1 deletion _layouts/post.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: default
---
<div class="post">
<div class="post container">

<header class="post-header">
<h1>{{ page.title }}</h1>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/screenshots/faq/faq-count-selected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
39 changes: 39 additions & 0 deletions faqs/_posts/2016-02-04-using-count-selected-function.md
Original file line number Diff line number Diff line change
@@ -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:

<br><br>
![](/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.
25 changes: 25 additions & 0 deletions faqs/_posts/2016-02-05-choice-filter-for-cascades-selects.md
Original file line number Diff line number Diff line change
@@ -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).

37 changes: 37 additions & 0 deletions faqs/_posts/2016-02-05-indexed-repeats.md
Original file line number Diff line number Diff line change
@@ -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.




12 changes: 12 additions & 0 deletions faqs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
layout: page
---
<div class="container">
<h2>FAQs</h2>
{% for posts in site.categories.faq %}
<ul>
<li><a href="{{ posts.permalink }}">{{ posts.title }}</a></li>
</ul>

{% endfor %}
</div>