Creating Adaptive Questionnaires

Using Answer Values in Adaptive Tags | Using Answer Labels in Adaptive Tags
Using Calculations in Adaptive Tags | Using System Variables in Adaptive Tags | Using URLs in Adaptive Tags
Using Database Queries in Adaptive Tags

The following sections provide information about creating adaptive questionnaires.

Adaptive questionnaires are those that change based on a respondent's answers, information contained in an external database, and/or dynamic calculations within a questionnaire. You create adaptive questionnaires by adding adaptive tags to any part of a question or answer within a questionnaire. You can also use adaptive tags to conditionally include or exclude specific multimedia elements under certain circumstances.

To add an adaptive tag to a question or answer, complete the following steps.

  1. Open the desired Question Editing or Answer Editing window.
  2. Select graphic to view a larger image.

  3. Type the text of your question or answer, move your cursor to the location in the question or answer where you want the adaptive tag located, select Tag, and then select Add Adaptive Tags.
  4. Select graphic to view a larger image.

  5. The system inserts an adaptive tag (i.e., «») at the location of the cursor.
  6. Select graphic to view a larger image.

  7. Enter the desired information inside the adaptive tag (e.g., «q1:1», where "q1:1" indicates the value of item 1 in question 1) and complete the question or answer text. Note: You may enter multiple adaptive tags in any given question or answer.

You can enter any number of different kinds of information within adaptive tags. With adaptive tags, you can embed

  • answer values (e.g., «q1», «q2:1»),
  • answer labels (e.g., «label(q3)»,
  • calculations (e.g., «q1-q2-q3»),
  • variables (e.g., «MAvg»),
  • URLs (e.g., «"<URL>http://web2.senecio.com:8080/askanywhere/date.jsp"»), and
  • database queries (e.g., «"<SQL>con2 select status from PasswordTable where passw="+q1:1»).

You can also enter a combination of these different kinds of information within adaptive tags. For instance, you can combine variables with URLs (e.g., «let date="<URL>http://web2.senecio.com:8080/askanywhere/date.jsp"»), variables with calculations and answer values (e.g., «let MAvg=q2:1*4»), etc. Basically, the possibilities are limited only by your creativity.

Note: Always enter text inside quotation marks.

In addition to being able to enter any number of different kinds of information with adaptive tags, you can make your adaptive tags unconditional or conditional.

  • Unconditional fills always embed the adaptive information (e.g., answer value, answer label, etc.).
  • Conditional fills only embed the adaptive information if certain conditions are met. Conditional fills enable you to use "if . . . then . . ." or "if . . . then . . .else . . ." statements to determine when adaptive information (e.g., a certain piece of data, a specific graphic, etc.) should be embedded. To define a conditional fill adaptive tag, enter the adaptive tag in one of the following formats.
    • «if a then b», where "a" must be a true/false statement (e.g., q1=2, q1>2, q1="yes") and "b" must identify the adaptive information to embed (e.g., q2:1, label(q2), "Good choice.", MAvg, C:\\images\image.gif).
    • «if a then b else c», where "a" must be a true/false statement (e.g., q1=2, q1>2, q1="yes"), "b" must identify the adaptive information to embed if "a" is true (e.g., q2:1, label(q2:1), "Good choice.", MAvg, C:\\images\image1.gif), and "c" must identify the adaptive information to embed if "a" is false (e.g., q2:2, label(q2:2), "Try again.", WAvg, C:\\images\image2.gif).

    Note: You can use conditional fills with answer values, answer labels, calculations, variables, URLs, database queries, and any combination of these). Basically, you are limited only by your creativity.

Note: To use adaptive tags with multimedia elements, enter the adaptive tag symbols (i.e., «») using your keyboard or copy them from another question or answer in your questionnaire. Then enter the conditional adaptive tag information about what multimedia elements you want to include or exclude under what circumstances.

The following sections provide additional information about entering various types of information (i.e., answer values, answer labels, calculations, variables, URLs, and database queries) in adaptive tags.

Using Answer Values in Adaptive Tags

AskAnywhere enables you to enter answer values inside adaptive tags. Answer values are the values associated with any specific answer to a question. For example, for a "yes/no" question, "yes" may be assigned an answer value of 1 and "no" may be assigned an answer value of 2. You can use these values to complete a calculation, insert the answer value from one question into the text of another question or answer, determine what graphic to display on a questionnaire page, etc. You can enter answer values within an adaptive tag in any of the following formats.

  • «Qa», where "a" identifies the fixed-choice question number from which you want the answer value to appear.
  • «Qa:b», where "a" identifies the open-ended question number and "b" identifies the item number within that question from which you want the answer value to appear.
  • «aaaaa», where "aaaaa" identifies the answer variable name (if one has been defined) of the fixed-choice question from which you want the answer value to appear.
  • «aaaaa:b», "where "aaaaa" identifies that answer variable name (if one has been defined) of the open-ended question and "b" identifies the item number within that question from which you want the answer value to appear.

Note: To view and test example questionnaires using answer values in unconditional and conditional adaptive tags, download the AdaptiveTagUnconditionalAnswerValuesExample and AdaptiveTagConditionalAnswerValuesExample files by selecting these links and open them using the AskAnywhere Editor.

Using Answer Labels in Adaptive Tags

AskAnywhere enables you to use answer labels from fixed-choice response sets inside adaptive tags. Answer labels are the labels associated with any specific answer to a question. For example, if a respondent indicated that they drank a certain brand of coffee in one question of the questionnaire, you could use the label for that answer (e.g., Folgers) in the text of another question asking whether they prefer the light, dark, or medium roast blend of the brand they choose. You can enter answer labels within an adaptive tag in any of the following formats.

  • «label(Qa)», where "a" identifies the question number from which you want the answer label to appear.
  • «label(aaaaa)», where "aaaaa" identifies the answer variable name (if one has been defined) of the question from which you want the answer label to appear.

Note: Answer labels can be used with single-response (i.e., those questions that allow respondents to select only one answer) or multiple-response (i.e., those questions that allow respondents to select more than one answer) type questions. If a single answer is selected, that single answer label appears. If multiple answers are selected, all of the answer labels appear separated by a slash (i.e., label1/label2).

Note: To view and test an example questionnaire using answer labels in adaptive tags, download the AdaptiveTagAnswerLabelsExample file by selecting this link and open it using the AskAnywhere Editor.

Using Calculations in Adaptive Tags

You can enter calculations in adaptive tags in any number of ways. For example:

  • You can identify answer values you want to use in your calculations by Qa (where "a" identifies the fixed-choice question number from which you want the answer value used in the calculation), Qa:b (where "a" identifies the open-ended question number and "b" identifies the item within that question from which you want the answer value used in the calculation), aaaaa (where "aaaaa" identifies the answer variable name of the fixed-choice question from which you want the answer value used in the calculation), or aaaaa:b (where "aaaaa" identifies the answer variable name of the open-ended question and "b" identifies the item within that question from which you want the answer value used in the calculation).
  • You can enter numbers (e.g., 1, 23, 456) directly into your calculations.
  • You can use mathematical symbols (i.e., +, -, /, *, =, ≠, <, ≤, >, ≥) in your calculations. Note: If you do not have these symbols on your keyboard, you can copy them from elsewhere. For example, the Skip/Filter Instructions window has all of these symbols available on it through the Skip Logic and Skip Math pull-down menus.
  • You can use parentheses to specify the order in which you want the calculation completed.
  • You can specify an "and/or" calculation by using the & (and) and | (or) symbols [e.g., "if (q1=2) & (q2=3) then q1:4" or "if (q1=2) | (q2=3) then q1:4"]. Parentheses must surround items on either side of the & and | symbols. Note: If you do not have these symbols on your keyboard, you can copy them from elsewhere. For example, the Skip/Filter Instructions window has both of these symbols available on it through the Skip Logic pull-down menu.
  • You can indicate a range of values using a comma (,) or the ellipsis () to separate the range of values (e.g., "q2=[1,5]" or "q2=[1. . .5]"). Brackets must surround items on either side of the range symbol. Note: If you do not have these symbols on your keyboard, you can copy them from elsewhere. For example, the Skip/Filter Instructions window has the ellipsis symbol available on it through the Skip Math pull-down menu.
  • You can use the following functions in your calculations: ROUND( ), TRUNC( ), SQR( ), SQRT( ), PowerTwo( ), Random( ), ButtonX( ), NumButtons( ), Len( ), IsNumber( ), ToNumber( ), LowerCase( ), and UpperCase( ). You can either type them in directly or copy them from elsewhere. For example, the Skip/Filter Instructions window has all these functions available on it through the Skip Functions pull-down menu. For more information about each of these functions, refer to Creating Skip Instructions.

Note: To view and test an example questionnaire using calculations in adaptive tags, download the AdaptiveTagCalculationsExample file by selecting this link and open it using the AskAnywhere Editor.

Using System Variables in Adaptive Tags

AskAnywhere enables you to define system variables as well as display their values inside adaptive tags. You can then use these system variables to hold temporary values for use in other parts of the questionnaire (e.g., for text fills, calculations, or skip logic). You can also save the values of these system variables along with the questionnaire data.

You enter variables in adaptive tags in the following format.

  • «aaaaa», where "aaaaa" identifies the system variable name (if one has been defined) from which you want the value to appear.
  • «let aaa=bbb», where "let" (not case specific) indicates that you are setting a system variable name, "aaa" identifies the alphanumeric name of the system variable (first character of the system variable name must be alphabetic), and "bbb" identifies the value you want to assign to the system variable. The value you want to assign to the system variable can be entered in any number of different ways. You can use an answer value, answer label, text, calculation, URL, another system variable, database query, or any combination of these.

System variables are declared and initialized the first time the page on which the variable is defined is displayed for the respondent. If the system variable name begins with a lowercase letter, the variable is reassigned each time that page is displayed. If the system variable name begins with an uppercase letter, the variable remains unaltered after it has been initialized, no matter how many times that page is displayed.

There are three types of variables: numeric, string, and Boolean (true/false). The following are examples of each type.

  • «Let average=(q1+q2+q3)/3» -- This is a numeric variable since the calculation results in a numeric value.
  • «Let temp=33.5» -- This is also a numeric variable.
  • «Let lastname=q4:1» -- This is a string variable if item 1 of the open-ended question 4 is declared as "text" or "text variable"; otherwise, this is a numeric variable.
  • «Let year="2002"» -- This is a string variable since the value is text (i.e., 2002 is enclosed in quotation marks making it a text value rather than a numeric value).
  • «Let surveyname="Great Lakes Political Poll "+year» -- This is a string variable using another variable to set its value. In this example, "surveyname" is being set to the text of "Great Lakes Political Poll" concatenated with whatever value is in the "year" variable.
  • «Let isgreater=q2>q1» -- This is a Boolean (true/false) variable. This statement sets the "isgreater" variable to "true" if the value in q2 is greater than the value in q1 and to "false" if the value in q2 is less than or equal to the value in q1.

Note: To view and test an example questionnaire using system variables in adaptive tags, download the AdaptiveTagSysVariablesExample file by selecting this link and open it using the AskAnywhere Editor.

Using URLs in Adaptive Tags

AskAnywhere enables you to use URLs inside adaptive tags. You can display the result of a URL, store the results of a URL in a variable, etc. The following examples show the format in which to enter URLs in adaptive tags.

  • To display the result of a URL in a questionnaire, enter the URL in «"<URL>http://aaa"» format, where the beginning and end quotes indicate the beginning and end of the URL, "<URL>" indicates that the following is a URL, and "http://aaa" identifies the desired URL.
  • To store the results of a URL in a variable, enter the URL in «let aaa="<URL>http://bbb"» format, where the beginning and end quotes indicate the beginning and end of the URL, "let" indicates that you are setting a variable name, "aaa" identifies the name of the variable, "<URL>" indicates tthat the following is a URL, and "http://bbb" identifies the desired URL.

Note: When using the HTML version of AskAnywhere, the data returned by the URL connection are interpreted by the browser and rendered properly if it is html-tagged data. The applet and CAPI versions of AskAnywhere always treat the returned URL data as text.

Note: To view and test an example questionnaire using URLs in adaptive tags, download the AdaptiveTagURLsExample file by selecting this link and open it using the AskAnywhere Editor.

Using Database Queries in Adaptive Tags

AskAnywhere enables you to use database queries inside adaptive tags. You can display the result of a database query, store the results of a database query in a variable, etc. The following examples show the format in which to enter database queries in adaptive tags.

  • To display the result of a database query in a questionnaire, enter the database query in «"<SQL>aaa select bbb"» format, where the beginning and end quotes indicate the beginning and end of the URL, "<SQL>" indicates that the following is a SQL database query, "aaa" identifies the name of the database connection (as defined in the AskAnywhere Administrator), and "select bbb" is a SQL statement.
  • To store the results of a database query in a variable, enter the database query in «let aaa="<SQL>bbb select ccc"» format, where the beginning and end quotes indicate the beginning and end of the URL, "let" indicates that you are setting a variable name, "aaa" identifies the name of the variable, "<SQL>" indicates tthat the following is a SQL database query, "bbb" identifies the name of the database connection (as defined in the AskAnywhere Administrator), and "select ccc" is a SQL statement.

Note: For more information about database connections, see the Setting up Database Connections section of the AskAnywhere Administrator's User Guide.

Creating Skip and Filter Instructions | Table of Contents | Formatting Page and Text Appearance

© Copyright 2002-2004 Senecio Software, Inc. All rights reserved.