ABCDEFGHIJKLMNOPQRSTUVWXYZ
1
typenamelabelchoice_filtercalculationrepeat_countnotes
2
select_one divisiondivisionSelect division
3
calculatedistrict_countcount(instance('dist')/root/item[division = ${division}])Use an XPath expression to filter dists by division and count how many there are.
4
notedistrict_count_note${district_count}
5
6
begin repeatdistrict_questions${district_count}
Repeat questions based on the number of districts.
7
calculatedistrict_namejr:itext(indexed-repeat(instance('dist')/root/item/itextId, instance('dist')/root/item[division = ${dividion}], position(..)))position(..) gives us the number of the district we're on. Use that as part of indexed-repeat to get the itextId of the current district. Use the jr:itext function to convert that itextId to a district name. Note: all this itext stuff is needed because pyxform always generates an itext block to make the form translation-ready even if there's only one language defined in the XLSForm
8
notedistrict_name_note${district_name}
9
end repeatdistrict_questions
10
11
12
13
14
15
16
17
18
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