UCL WIKI

UCL Logo
Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The set of condition logic is based on Boolean operators (OR, AND, NOT) used in programming or database searching. These operators, particularly OR and AND, are used to combine pieces of condition logic code. The symbols || and && are used to denote OR and AND, respectively. See Example 5 above. Condition logic is placed within square brackets adjacent to the condition text. In Example 3 above, [qc_A3_a == 1] describes that the respondent should advance to the true branch if they responded with code list value 1 to question qc_A3_a.

The answer giving rise to a condition can be a code list value, numeric answer or a text answer. Most condition logic refers to a code list value from a previous question. The corresponding code value is used without any quotations as seen in Example 3. For numeric answers single quotations are used (see Example 9 below) and for text or date answers double quotation marks are used (see example 10 and example 17). Table 1. Condition Notation provides a summary.

...

Archivist view (ncds_69_eq):

Anchor
Example10
Example10

Example 10 Questionnaire: NCDS Parental Questionnaire 1974


Questionnaire layout:


Archivist view (ncds_74_pq):  

...

It is possible to have a condition which does not relate to a question. This is common in the introduction to a questionnaire. In Example 13 below, there is no previous question that the condition can be based on such as: 'Are you in full-time work?'. In this case, Therefore there is no condition logic to be entered and the square brackets will appear empty in the Archivist doc view.

As there is no question to reference for the condition, the condition label numbering uses the question number for is labelled after the first question that is dependent on the condition.that condition in this case qc_51e. See Construct a Label for more on how to name conditions.

Example 13 Questionnaire: NSHD Main Questionnaire 1989

...

Archivist view (alspac_04_pal):


...

Anchor

...

Date
Date
Using Date in condition logic

When dates are indicated with numbers they can be represented in different ways. This could make a number of issues when interpreting the data in a later stage. Therefore we adopt ISO 8601 standard to tackle the uncertainty by setting out an internationally agreed way to represent the dates:  YYYY-MM-DD

Example 17 Questionnaire: National Survey of Health and Development (nshd_72_mq)


Questionnaire view:

Image Added



Archivist view (nshd_72_mq):

Image Added


Anchor
Grid Coordinates
Grid Coordinates

Tip
iconfalse
titleTable 1. Condition Notation

Comparisons

==

Is equal to

!=

Is NOT equal to

Less than

Greater than

Joining

&&

To join two comparisons using an AND

||

To join two comparisons using an OR

Qualifiers

‘ (single quote)

Meta value (numeric)

“ (double quote)

Literal string

...

(text, date)



Tip
borderWidth= 500.0px;
iconfalse
titleTable 2

Grid coordinates

$X$Col;YRow

Used to specify a cell or multiple cells of a grid


qc_example$3example$1;21


Example

Col 1Col 2

Row 1


Row 2


Row 3



qc_example$1;2

Example

Col 31

Row 1


Row 2


Row 3



qc_example$2;*


Example

Col 1

Col 2

Col 3

Row 1




Row 2




Row 3





qc_example$*;1


Example

Col 1

Col 2

Col 3

Row 1




Row 2




Row 3





qc_example


Example

Col 1

Col 2

Col 3

Row 1




Row 2




Row 3





qc_example$2:3;*

Example

Col 1

Col 2

Col 3

Row 1




Row 2




Row 3





qc_example$1,3;*

Example

Col 1

Col 2

Col 3

Row 1




Row 2




Row 3

...