Questionnaire design

Display condition

A display condition is a logical expression which determines whether a question is displayed. It is a way to implement skip logic which is much more robust than simple skips or calculated skips because it is directly associated with the destination question.

The logical expression must use the xBase logical expression format (for experts: the expression can also follow Perl syntax and use any variable in the Perl environment if the condition is presented between "{" and "}" signs). It may use any of the variables defined in the questionnaire, including prepopulated data. Basics of the xBase logical expression format are as follows:

  • comparison operators are: .EQ., .NE., .GT., .GE., .LT., .LE.
  • logical operators are: .AND., .OR., .NOT.
  • simple mathematical operations such as: +, -, /, *, **
  • parentheses are permissible and affect the order of interpretation.
  • questionnaire languages can be identified using the following syntax: LANGUAGE(la) or LANGUE(la) where "la" is a single two-letter ISO language code or a series of them separated by commas and/or spaces.
  • empty variables can be identified using the following syntax: ISEMPTY(Q1) or ESTVIDE(Q1) (Q1 is replaced with the appropriate field name, which could be an open-end part name).
  • non-empty variables can be identified using the following syntax: NOTEMPTY(Q1) or NONVIDE(Q1) (Q1 is replaced with the appropriate field name, which could be an open-end part name).
  • QUESTION(Q1) is true if Q1 is the current question when the test is performed. QUESTION(Q1...) is true if the name of the current question when the test is performed starts with Q1.
  • NRESPONSES(Q1) returns the number of responses given to Q1.
  • MOBILE() returns 1 or true if the questionnaire is displayed on a mobile device (0 otherwise).
  • ACCESS() returns 1 or true if the questionnaire is displayed in accessiblity mode (0 otherwise).
  • when using .EQ. and .NE. (on regular single-answer and regular multiple-answer questions as well as integer open parts), the right side of the comparison may take three forms:
    • Q1.EQ.1 and Q1.NE.1 compare the answer to Q1 to a single integer
    • Q1.EQ.1,3,5 and Q1.NE.1,3,5 compare the answer to Q1 to a each integer and returns true if one of them matches (for .EQ.) or none of them matches (for .NE.)
    • Q1.EQ.1-5 and Q1.NE.1-5 compare the answer to Q1 to a each integer between the two bounds and returns true if one of them matches (for .EQ.) or none of them matches (for .NE.)
    • Q1.EQ.1-5,7 and Q1.NE.1-5,7 compare the answer to Q1 to a each integer between the two bounds as well as other individual values (any number of ranges or individual values can be supplied between commas) and returns true if one of them matches (for .EQ.) or none of them matches (for .NE.)

CallWeb takes care of applying the xBase logic on multiple-answer questions.

Remember that all answer categories are numeric. This simplifies the construction of logical expressions.

Example of a display condition segment:

    % Display condition
    (Q1.GT.2.AND.Q2.EQ.1)

When CallWeb encounters a display condition which evaluates to "false", it erases any data that the associated question may contain in its numeric and open-end portions — however, it does not erase the destination of a CALCUL variable. This is a logical behaviour since that question should not have been displayed to start with — although it may have been legitimately displayed before the user backtracked and changed previous answers. To create a non-displayed variable where data must be stored (such as prepopulated fields), consider using the open-end portion of a BLANK question or the NEVERUPDATE or STOCK question types, or the display condition must be prefixed with a tilde (~) to indicate a non-cleaning display condition (much like the tilde prefix makes a simple skip non-cleaning)..

It is possible to borrow the display condition from another question by inserting a single line in the display condition section. This line contains the symbol "=" and the name of the question from which to borrow such as in the following:

    =Q1

Borrowing questions and questions borrowed from need not be in any particular order in the questionnaire.

Questionnaire design

Display condition

A display condition is a logical expression which determines whether a question is displayed. It is a way to implement skip logic which is much more robust than simple skips or calculated skips because it is directly associated with the destination question.

The logical expression must use the xBase logical expression format (for experts: the expression can also follow Perl syntax and use any variable in the Perl environment if the condition is presented between "{" and "}" signs). It may use any of the variables defined in the questionnaire, including prepopulated data. Basics of the xBase logical expression format are as follows:

  • comparison operators are: .EQ., .NE., .GT., .GE., .LT., .LE.
  • logical operators are: .AND., .OR., .NOT.
  • simple mathematical operations such as: +, -, /, *, **
  • parentheses are permissible and affect the order of interpretation.
  • questionnaire languages can be identified using the following syntax: LANGUAGE(la) or LANGUE(la) where "la" is a single two-letter ISO language code or a series of them separated by commas and/or spaces.
  • empty variables can be identified using the following syntax: ISEMPTY(Q1) or ESTVIDE(Q1) (Q1 is replaced with the appropriate field name, which could be an open-end part name).
  • non-empty variables can be identified using the following syntax: NOTEMPTY(Q1) or NONVIDE(Q1) (Q1 is replaced with the appropriate field name, which could be an open-end part name).
  • QUESTION(Q1) is true if Q1 is the current question when the test is performed. QUESTION(Q1...) is true if the name of the current question when the test is performed starts with Q1.
  • NRESPONSES(Q1) returns the number of responses given to Q1.
  • MOBILE() returns 1 or true if the questionnaire is displayed on a mobile device (0 otherwise).
  • ACCESS() returns 1 or true if the questionnaire is displayed in accessiblity mode (0 otherwise).
  • when using .EQ. and .NE. (on regular single-answer and regular multiple-answer questions as well as integer open parts), the right side of the comparison may take three forms:
    • Q1.EQ.1 and Q1.NE.1 compare the answer to Q1 to a single integer
    • Q1.EQ.1,3,5 and Q1.NE.1,3,5 compare the answer to Q1 to a each integer and returns true if one of them matches (for .EQ.) or none of them matches (for .NE.)
    • Q1.EQ.1-5 and Q1.NE.1-5 compare the answer to Q1 to a each integer between the two bounds and returns true if one of them matches (for .EQ.) or none of them matches (for .NE.)
    • Q1.EQ.1-5,7 and Q1.NE.1-5,7 compare the answer to Q1 to a each integer between the two bounds as well as other individual values (any number of ranges or individual values can be supplied between commas) and returns true if one of them matches (for .EQ.) or none of them matches (for .NE.)

CallWeb takes care of applying the xBase logic on multiple-answer questions.

Remember that all answer categories are numeric. This simplifies the construction of logical expressions.

Example of a display condition segment:

    % Display condition
    (Q1.GT.2.AND.Q2.EQ.1)

When CallWeb encounters a display condition which evaluates to "false", it erases any data that the associated question may contain in its numeric and open-end portions — however, it does not erase the destination of a CALCUL variable. This is a logical behaviour since that question should not have been displayed to start with — although it may have been legitimately displayed before the user backtracked and changed previous answers. To create a non-displayed variable where data must be stored (such as prepopulated fields), consider using the open-end portion of a BLANK question or the NEVERUPDATE or STOCK question types, or the display condition must be prefixed with a tilde (~) to indicate a non-cleaning display condition (much like the tilde prefix makes a simple skip non-cleaning)..

It is possible to borrow the display condition from another question by inserting a single line in the display condition section. This line contains the symbol "=" and the name of the question from which to borrow such as in the following:

    =Q1

Borrowing questions and questions borrowed from need not be in any particular order in the questionnaire.