- Regular Section
-
-
Ability to reference any field in a Cascading Select in future questions for validations/calculations.
Example:
- There is a cascading select question where MU selects a district
- Depending on the district selected, an applicant ID is generated using the first 2 letters of the district numeric plus concatenated timestamp . So the first applicant id in Tecoman district will be (for example)Te1484220310942
- Household barcode scanned should be validated based on barcodes assigned per county. Barcodes start with first 3 letters of a county. All barcodes in Colima County start with 'Col'
-
Regular Section: Client ID
Q1 Caption: Date of application
Q1 name: date_of_application
Q2 Caption: Select District (cascading select question - Country → County → District)
Q2 Name: select_district
(User selects 'Mexico' Country, 'Colima' County and 'Tecoman' District)
Question 3 Caption: Applicant ID (first 2 letters of the district numeric plus concatenated timestamp from Question 1 above)
Question 3 Name: applicant_id
Question 4 Caption: Select country
Question 4 Name: select_country
Question 5 Caption: Scan Household barcode ID
Question 5 Name: scan_household_barcode_id/*Javacript on Q3 - Applicant ID (first 2 letters of the district numeric plus concatenated timestamp*/
tw.client_id.applicant_id.value = tw.client_id.select_district["District"].value.substr(0, 2) + tw.client_id.date_of_application.value.getTime();
/*Javacript on Q5 - To validate Household barcode based on barcodes assigned per county. Barcodes start with first 3 letters of a county.*/
var countyFirstThreeLetters = tw.client_id.select_county["County"].value.substr(0, 3);
if (!tw.client_id.scan_household_barcode_id.value.startsWith(countyFirstThreeLetters))
{
throw "The barcode should start with " + countyFirstThreeLetters;
}
-
- There is a cascading select question where MU selects a district
- Calculate total inflow and total outflow for the respondent. Field Officers are supposed to balance the inflows and outflows – if the total inflows are 300, the total outflow should be close, if not, 300 as well
-
Regular section: Inflows
Question 1 Caption: Earnings from sale of milk
Question 1 Name: earnings_from_sale_of_milk
Question 2 Caption: Earnings from eggs
Question 2 Name: earnings_from_egg
Question 3 Caption: Salary per week
Question 3 Name: salary_per_week
Question 4 Caption: Total inflows
Question 4 Name: total_inflows
Regular Section 2 - Outflows
Question 5 Caption: Cost of animal feeds
Question 5 Name: cost_of_animal_feeds
Question 6 Caption: Cost of household food
Question 6 Name: cost_of_household_food
Question 7 Caption: Other expenditures
Question 7 Name: other_expenditures
Question 8 Caption: Total outflows
Question 8 Name: total_outflows
Regular Section: Balance
Question 9 Caption: Check balance of outflows and inflows
Question 9 Name: check_balance_of_outflows_and_inflows/*Regular Section - Inflows*/
/*JS - on Q4 (Total of Q1, Q2 and Q3)*/
tw.inflows.total_inflows.value =
tw.inflows.earnings_from_sale_of_milk.value +
tw.inflows.earnings_from_egg.value +
tw.inflows.salary_per_week.value;
/*Regular Section - Outflows*/
/*JS on Q8 (Total of Q5, Q6 and Q7)*/
tw.outflows.total_outflows.value =
tw.outflows.cost_of_animal_feeds.value +
tw.outflows.cost_of_household_food.value +
tw.outflows.other_expenditures.value;
/*Repeat Section: Balance*/
/*Javascript on Q9 (compare Q4 and Q8) (if the total inflows are 300, the total outflow should be close, if not, 300 as well.)*/
tw.balance.check_balance_of_outflows_and_inflows.value = tw.inflows.total_inflows.value - tw.outflows.total_outflows.value;
-
-
-
- Repeat Section
-
-
Ability to reference any field in a Cascading Select in future questions for validations/calculations
Example:
- There is a cascading select question where MU selects a district
- Depending on the district selected, a applicant ID is generated using the first 2 letters of the district numeric plus concatenated timestamp . So the first applicant id in Tecoman district will be (for example) Te1484220310942
- Household barcode scanned should be validated based on barcodes assigned per county. Barcodes start with first 3 letters of a county. All barcodes in Colima County start with 'Col'
-
Regular Section: Client ID
Question 1 Caption: Date of application
Question 1 name: date_of_application
Question 2 Caption: Select District (cascading select question - Country → County → District)
Question 2 Name: select_district
Q3 Caption: Applicant ID (first 2 letters of the district numeric plus concatenated timestamp from Question 1 above)
Q3 Name: applicant_id
Q4 Caption: Select country
Q4 Name: select_country
Repeat Section - Demographic
Q5 Caption: Scan Household barcode ID
Q5 Name: scan_household_barcode_id/*Javacript on Q3 - Applicant ID (first 2 letters of the district numeric plus concatenated timestamp*/
tw.Demographic.current.applicant_id.value = tw.client_id.select_district["District"].value.substr(0, 2) + tw.Demographic.current.date_of_application.value.getTime();
/*Javacript on Q5 - To validate Household barcode based on barcodes assigned per county. Barcodes start with first 3 letters of a county.*/
var countyFirstThreeLetters = tw.client_id.select_county["County"].value.substr(0, 3);
if (!tw.Demographic.current.scan_household_barcode_id.value.startsWith(countyFirstThreeLetters))
{
throw "The barcode should start with " + countyFirstThreeLetters;
}
- There is a cascading select question where MU selects a district
- Land use – how much land do you use for crop 1, crop 2, crop 3, etc – and how much total land do you have (total land should be >= sum of individual crop land)
-
Repeat Section: Crops and Land
Section Name: crops_and_land
Q1 Caption: How much land do you use for crop?
Question 1 Name: how_much_land_do_you_use_for_crop
Regular section: Total Land
Section Name: total_land
Question 2 Caption: How much total land do you have?
Question 2 Name: how_much_total_land_do_you_have/*JS on Question 2*/
var totalLandForCrops = 0;
for (var i = 0; i < tw.crops_and_land.length; i++)
{ /* iterate over all repeated sections */
var currentcrop = tw.crops_and_land[i];
totalLandForCrops += currentcrop.how_much_land_do_you_use_for_crop.value;
}
if (tw.total_land.how_much_total_land_do_you_have.value < totalLandForCrops)
{
throw "Total land owned cannot be less than total land used for crops";
}
-
-
-
Comments
0 comments
Please sign in to leave a comment.