Questionnaire (AskiaScript version 1)

This section describes AskiaScript version 1, which has been superseded by AskiaScript 2.0.
 

()

Use this tag to delimit askiascript statements. It enables you to define a function's target, for example:

On(??Q1??, "yes", "no")

 

Furthermore, for an Askia script to be intelligible, it is important to delimit the statements it is composed of, for example, the following is not valid:

??Q1??=1 And ??Q2??=5 Or ??Q2??=7

Instead, by just adding the () tags, we can specify two different Askia scripts:

??Q1??=1 And (??Q2??=5 Or ??Q2??=7)

(??Q1??=1 And ??Q2??=5) Or ??Q2??=7

"" string

Use this tag to delimit a string of characters.

For example:

"text text text text text"

 

Furthermore, when used on its own, this tag enables you to make reference to the Askia system's "Don't Know" response for an open question, for example:

??Q1??=""

?? ?? variable

Use this tag to refer to a variable. In other words, to refer to a variable, you must delimit its ShortCut with: ??

For example:

??Q1 Name?? will refer to openquestion Q1 Name

Note: the ?? ?? tag can be used in long captions, item captions, askiascript statements, and screens' cells.

%%Shortcut%%

Use this function to retrieve the entry code.

!! !! run

Use this tag to run an Askia script that is not contained in a routing instruction's condition or values. For example, you may wish to execute an Askia script on a questionnaire's screen, such as:

<TD !!On(??Q1??={1; 3; 5; 7}, "bgcolor=blue", "bgcolor=white")!!>

<IMG border=0 src="!!??ImageName??[1][CurrentItem(1)]!!">

Note: the !! !! run tag enables you to execute an Askia script in long captions, item captions, screen cells, and on the edit page of AskiaWeb.

[] array

Use this tag to refer to an array. An array is a set of value(s) contained by a variable.

Single or multi-coded closed questions can contain arrays when they are a loop's sub-variable. For example, we have a loop with three items, and Q1, a single-coded question as sub-variable.

??Q1??[1]         refers to the sub-variable’s data collected during the loop’s first iteration.

??Q1??[3]         refers to the sub-variable’s data collected during the loop’s third iteration.

 

Open questions can also contain arrays, when they are importing data and their property use as an array is enabled. For example, we have an open question Q1, into which we are importing data from six different fields via an SQL query. Suppose the following is imported during data-entry:

01|75010|PARIS|FR|PETER|HOLMES|

??Q1??[1]         will return the value: "01".

??Q1??[3]         will return the value: "PARIS".

CI()

CI() is a shorter synonym for the CurrentItem() function. Please see below for details of this function.

CurrentItem()

Use this function to refer dynamically to a loop's iterations. In this function, "CurrentItem" literally refers to the item which a loop is currently iterating. The numerical integer value specified in () indicates which level the function is addressing, that is, which loop it is addressing. By default, when creating a loop you create a level. Thus, CurrentItem(1) makes reference to the item currently being iterated by the immediately above level.

For example, let's imagine we have a first loop, LoopA, containing the items: A, B and C. LoopA has a sub-loop, sub-loopB, containing the items: 1, 2 and 3. Finally, sub-loopB has a sub-variable: Q1, which is a closed question, containing the items yes and no. This structure is what we call a loop of a loop. We have two levels, one for each loop, thus, Q1 will be asked for each item of sub-loopB, which in turn will be iterated anew for each item of LoopA. That is, Q1 will be asked a total of nine times (3x3).

For example:

Let's say we have a question table loop called Brands, containing the items: A, B and C. Then we have a sub-question called Q1.

CI(1)=2

means Brands is currently iterating item B.

??Q1??[CI(1)]=2

means when answer 2 is given to Q1, for any of the items iterated by Brands

CurrentItemOrder()

Use this function to indicate the order of the current item in a loop, taking into account any rotation present.

For example:

CurrentItemOrder(1)=2

means the loop is currently iterating item B.

CvDKNA()

Use this function to convert a numeric question's Askia system codes for "Don't know" and "Not Asked" into 0.

CvDKNA(??Q1??)

You can further define the function to convert all responses, along with the system DKs and NAs, to a binary format 0 or 1. The function will convert those values you specify to 1, and all other values to 0.

For example:

CvDKNA(??Q1??)=55

DKs, NAs and any answer except 55 will be coded into: 0. The value 55 will be coded into: 1.

CvDKNA(??Q1??)IsIncludedIn{5 To 10}

The following values will be coded into 1: 5, 6, 7, 8, 9 and 10.

The following values will be coded into 0: all other values.

AvailableQuota("")

Use this function to determine the specific responses still available for quotas on a given question. The function returns a set of numbers indicating which responses are still available.

For example:

AvailableQuota("Gender")

would return {1:2} if none of the quotas were closed for gender (i.e. responses 1 and 2 are still available).

AvailableQuota("Region:1; Age")

would return the list of ages available in region 1.

AvailableQuota("Region; Age")

would return the list of ages available in the current region.

InterviewTime

Use this function to find the time spent on a question or between two questions

InterviewTime(Shortcut1, Shortcut2, ThisIterationOnly)

Shortcut1 is a string that indicates the first shortcut. The function returns the time taken to respond to the specified question.

Shortcut2 is a string that indicates the second shortcut. This parameter is optional. If it is present, the function will return the time taken between the two questions specified in Shortcut1 and Shortcut2.

ThisIterationOnly (0 or 1) indicates if we should only time the current iteration or all iterations (default). This parameter is optional.

Examples:

  • InterviewTime("Gender") returns the time spent to answer the question gender.

  • InterviewTime("Gender","Age") returns the time spent to answer the question gender to the question age (including both the stated questions, and all questions placed between).

  • InterviewTime("Gender","Age",1) would return the time spent between gender and age in the current item (supposing the questions gender and age are in a loop and that the function call is made within that loop).

IsQuotaFullFor("")

Use this function to trigger an Action when a specific simple or crossed quota has been reached.

For example:

IsQuotaFullFor("Q1")

if any of the quotas defined for Q1 have been reached, the function will return the value True. If none of Q1’s quotas have been reached it will return the value False.

IsQuotaFullFor("Q1:"+1)

if the quota defined for Q1’s response item 1 has been reached, the function will return the value True. If the quota defined for Q1’s response item 1 has not been reached it will return the value False.

IsQuotaFullFor("Q1;Q2")

if any of the crossed quotas defined for Q1 by Q2 have been reached, the function will return the value True. If none of the crossed quotas defined for Q1 by Q2 have been reached it will return the value False.

IsQuotaFullFor("Q1;Q2:"+1)

if the crossed quotas defined for Q1 by Q2's response item 1 has been reached, the function will return the value True. If the crossed quotas defined for Q1 by Q2’s response item 1 has been reached it will return the value False.

IsQuotaReached

Use this function to manage a questionnaire's quotas, such as defining a specific action once any quota has been reached.

For example, we can add the following condition to a routing instruction:

IsQuotaReached

This function will systematically evaluate all the *.QES file’s existing quotas to see whether they have been reached. If no quota has yet been reached, it will return the value False. When one or more quota(s) has been reached, it will return the value True.

Note: the use of this function is only necessary when managing quotas manually. We recommend that you manage your quotas either with the semi-automatic or automatic option.

MaxQuotaToDo()

Use this function to determine which quota to prioritize.

Some methodologies demand that you use the least filled quota. This is complex to achieve using other functions (e.g. importing all the QuotaToDo in a loop with numeric questions and using an IndexOfMax). MaxQuotaToDo makes this procedure easier.

For example, if we have a closed question called ProductToTest:

MaxQuotaToDo("ProductToTest")

If the question to test is a branch:

MaxQuotaToDo("Region:1; ProductToTest")

The second parameter is 1 by default, but allows you to specify the second (or third...) target.

Note: When testing the questionnaire in askiadesign, this function will always return the value 1. This is because the actual quotas have to be defined in the AskiaField CCA.

OrderOf("")

Use this function to retrieve the order in which the responses for a question or a loop were presented, or the order of the sub-questions for a chapter.

OrderOf("Shortcut")

For example:

Q1

B

A

C

OrderOf("Q1") returns {2;1;3}

Other

Use this operator to refer to semi-open responses in closed questions.

For example:

??Q1??=OTHER

or

??Q1??={1;4;6;OTHER}

PrctDone

Use this function to return the percentage value of progression through the questionnaire.

This function enables you to calculate, during data collection, how much of the questionnaire has already been answered by the respondent. For example, if we have a questionnaire made of four questions (Q1, Q2, Q3 and Q4), we may decide to paste the following Askia script in the variables’ long captions:

You have completed !!PrctDone!!% of the survey.

When a respondent gets to Q3, the function will return 50. That is to say, when arriving on Q3, the respondent has already answered Q1 and Q2, which represents 50% of the questionnaire.

Note: this function calculates the progress according to a questionnaire's entire data-entry mask, regardless of whether some variables or sections are not set to be visible during data-entry.

QuotaToDo()

Use this function to retrieve the number of outstanding interviews that need to be conducted for a specific variable's quota to be reached.

For example, if we have a closed question called Q1, containing two response items, Male and Female:

QuotaToDo("Q1:1")

returns the number of Male interviews left to do.

Note: When testing the questionnaire in AskiaDesign, this function will always return the value 1. This is because the actual quotas have to be defined in the AskiaField CCA.

ResponseCount()

Use this function to return the number of modalities in the specified question.

Note: This function is only available within AskiaDesign and AskiaEntry.

For example:

ResponseCount("Gender") should return 2

ResponseCode()

ResponseCodeN()

Use this function to refer to the selected response item by its entry code. When entry codes are not numeric, use ResponseCode(). When they are numeric, use ResponseCodeN().

Note: This function is only available within AskiaDesign and AskiaEntry.

For example:

Assuming the entry codes for the question "Gender" are Male 03 and Female 04:

ResponseCode("Gender:"+??Gender??) Has {03}

will refer to the response item Male.

ResponseCodeN("Gender:"+??Gender??) Has {3}

is the equivalent when the response codes are numeric.

ResponseText(":"+) or RT()

The function name may be written as ResponseText or the abbreviation RT.

Use this function to retrieve the selected response item's text caption, in a single-coded closed question.

For example:

ResponseText("Q1:"+2) for the second item in q1

ResponseText("Q1:"+??Q1??) for the response selected in q1

SubQuestionsAsXML()

This function returns a list of the questions at one level down from the specified one. It allows multiple semi-opens to be supported in Askia Design Controls.

The function returns a list in the following format:
Shortcut1Shortcut2
 

This list can then be parsed by the ADC to know where to write the result of the semi-opens.

 

Create your own Knowledge Base