Sample - Filter out household head option once selected
 Share
The version of the browser you are using is no longer supported. Please upgrade to a supported browser.Dismiss

View only
 
 
ABCDEFGHIJKLMNOPQRSTUVWXYZ
1
typenamelabelhintdefaultappearanceconstraintconstraint messagerelevancedisabled
required
required message
read only
calculation
repeat_count
media:image
media:audio
media:video
choice_filternoteresponse_note
publishable
minimum_seconds
2
startstarttime
3
endendtime
4
deviceiddeviceid
5
subscriberidsubscriberid
6
simserialsimid
7
phonenumberdevicephonenum
8
usernameusername
9
calculatedurationduration()
10
notenote
Welcome to this SurveyCTO sample form on household head filtering!

In this sample you will learn how to filter out the option to select "household head" as the role of a member of a household roster. Once "household head" has been picked once, it will be filtered out by the choice_filter expression in this design in all subsequent repeat instances.

One of the great thing about this design is that the user can change their mind; simply go back to the originally indicated household head and pick another role, to "free up" the household head option. This approach is also better than using a constraint to prevent repeated selections, as it is better to just filter out choices that should not be selected at all.

Either download a copy as an Excel workbook from File > Download, or save a copy in your own Google Drive.
intro
11
integersize
How many members does your household have?
12
begin repeatrepeatGroupfield-list${size}
13
calculateindexindex()
14
textname
What is household member ${index}'s name?
yes
15
integerageWhat is this member's age?yes
16
select_one relationshiprelationship
What is this member's relationship to the household head?
yes
${relationship} = filter or not(selected(${calc_join}, filter))
17
end repeat
18
calculatecalc_join
join(' ', ${relationship})
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Loading...