Difference between revisions of "Relevance Condition to Multiple Fields"
Kbjarkefur (talk | contribs) (Created page with "If you want to apply the same relevance code to multiple fields you should not copy your code. Copying the same code to a couple of fields could be OK depending on personal pr...") |
Tag: New redirect |
||
(12 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
#REDIRECT[[SurveyCTO Additional Topics#Relevance Condition to Multiple Fields]] | |||
Here | ==Relevance Condition to Multiple Fields== | ||
There are ways to apply the same relevance code to multiple fields without copying it. Copying the same code to a couple of fields can be acceptable depending on personal preference, but copying to 5 or more fields should always be avoided as it increases the likelihood of making programming mistakes. | |||
It is recommended to use a begin group field to apply the same relevance code to all the fields inside the group. Then, the relevance code is indicated only for the begin group field and there is no need to repeat it for all the fields for which the relevance code is necessary. A [[Questionnaire Programming|questionnaire coded]] like this will be much easier to update during the development phase or during the field work where there is little time as many other tasks are keeping the project team pre-occupied. | |||
In general, using begin groups field in a programming form avoids the repetition of codes and makes the whole [[Survey Pilot|survey]] easy to read and to understand. | |||
== Code example == | |||
Here is a [https://docs.google.com/spreadsheets/d/17U64Bu3oUyfa8MmJ7_tM8DQ5_ZUO_MPzx9vT28hfpgk code example] that shows how a group is used so that the relevance condition does not have to be applied to each field inside the group. | |||
Note that there is no problem with having a field be required which is not always shown: required means that if the field is displayed then data needs to be recorded for this field before the [[Enumerator Training|enumerator]] is allowed to swipe past this question. | |||
== Back to Parent == | |||
This article is part of the topic [[SurveyCTO Coding Practices]] | |||
[[Category: SurveyCTO Coding Practices ]] |
Latest revision as of 23:44, 20 July 2023
Relevance Condition to Multiple Fields
There are ways to apply the same relevance code to multiple fields without copying it. Copying the same code to a couple of fields can be acceptable depending on personal preference, but copying to 5 or more fields should always be avoided as it increases the likelihood of making programming mistakes.
It is recommended to use a begin group field to apply the same relevance code to all the fields inside the group. Then, the relevance code is indicated only for the begin group field and there is no need to repeat it for all the fields for which the relevance code is necessary. A questionnaire coded like this will be much easier to update during the development phase or during the field work where there is little time as many other tasks are keeping the project team pre-occupied.
In general, using begin groups field in a programming form avoids the repetition of codes and makes the whole survey easy to read and to understand.
Code example
Here is a code example that shows how a group is used so that the relevance condition does not have to be applied to each field inside the group.
Note that there is no problem with having a field be required which is not always shown: required means that if the field is displayed then data needs to be recorded for this field before the enumerator is allowed to swipe past this question.
Back to Parent
This article is part of the topic SurveyCTO Coding Practices