Response type variable

In AskiaScript, the response type variable contains all available information and actions that can be executed on a response item.

To create a response type variable, create a response in the survey structure. This object is accessible through the Responses Collection via the properties Responses, AvailableResponses and Answers of the question object.

In this topic:

Properties

Caption

Returns the caption of the response.

Returns a String.

Example
gender.Responses[1].Caption ' => "Man"

↑ Top of page ↑

Children

Available from version 5.5.3.

Returns the list of child responses for a given response.

Returns a collection of responses.

Example
CurrentQuestion.AvailableResponses.Roots[1].Children

↑ Top of page ↑

EntryCode

Returns the entry-code of the response as a number.

Returns a Number.

Examples
brands.Responses[1].EntryCodeStr ' => "001"
brands.Responses[1].EntryCode ' => 1

↑ Top of page ↑

EntryCodeStr

Returns the entry-code of the response as a string.

Returns a String.

Example
country.Responses[1].EntryCodeStr ' => "US"

↑ Top of page ↑

Factor

Returns a factor, if it was entered in the value column of the scale responses.

Returns a Number.

Examples
gender.Responses[1].Factor ' => 3
country.AvailableResponses[1].Factor ' => 7

↑ Top of page ↑

Id

Available from version 5.3.3.

Internal unique identifier of the response.

Returns a Number.

Examples
CurrentQuestion.AvailableResponses[1].id  ' => 456
CurrentQuestion.AvailableResponses[2].id ' => 455

↑ Top of page ↑

Index

Returns the index of the response (based 1) as it was entered.

Examples
gender.Responses[1].Index  ' => 1
gender.Responses[2].Index  ' => 2

↑ Top of page ↑

IsExclusive

Indicates whether the response is considered (flag) as a "Don't know" or "Not asked" answer.

This property always returns  True for a single closed question, even if it is linked into a multiple.

Returns a Boolean.

Example
gender.Responses[3].IsExclusive ' => True

↑ Top of page ↑

IsHeader

Available from version 5.5.3.

Indicates if the response is a header response.

Returns a Boolean.

Examples
CurrentQuestion.AvailableResponses[1].IsHeader  ' => true
CurrentQuestion.AvailableResponses[2].IsHeader ' => false

↑ Top of page ↑

IsIgnored

Indicates whether the response is ignored.

Returns a Boolean.

Example
brands.Responses[5].IsIgnored ' => False

↑ Top of page ↑

IsOpen

Available from version 5.5.3.

Indicates if the response is a semi open response.

Returns a Boolean.

Examples
CurrentQuestion.AvailableResponses[1].IsOpen  ' => true
CurrentQuestion.AvailableResponses[2].IsOpen ' => false

↑ Top of page ↑

IsSelected

Available from version 5.3.3.

Indicates if the response was previously selected (included in the Question.Answers collection).

Returns a Boolean.

Examples
CurrentQuestion.AvailableResponses[1].IsSelected  ' => true
CurrentQuestion.AvailableResponses[2].IsSelected ' => false
' Similar than
' CurrentQuestion.Value Has CurrentQuestion.AvailableResponses[2].Index

↑ Top of page ↑

OpenQuestion

Available from version 5.5.3.

Returns the question object attached to the semi open response.

Returns a Question.

Example
brands.Responses[5].OpenQuestion

↑ Top of page ↑

Order

Returns the order of the response (based 1) as it was displayed during the interview. Returns DK if the question is skipped or the response was ignored.

Returns a Number.

Examples
brands.Responses[1].Order  ' => 2
brands.Responses[2].Order  ' => 1

↑ Top of page ↑

Parent

Available from version 5.5.3.

Returns the parent response.

Returns a response.

Example
CurrentQuestion.AvailableResponses.Roots[1].Children[1].Parent

↑ Top of page ↑

Rank

Available from version 5.3.3.

Indicates in which order the answer has been selected by the respondent.

The possible range of values runs from 0 (when the response was not selected) to the number of selected answers by the respondent.

Returns a Number.

Examples
CurrentQuestion.AvailableResponses[1].Rank  ' => 0 (not selected)
CurrentQuestion.AvailableResponses[2].Rank ' => 2 (second selected)
CurrentQuestion.AvailableResponses[3].Rank ' => 1 (first selected)

↑ Top of page ↑

ResourceURL

Returns the URL of any resource for the response.

Returns a String.

Example
gender.Responses[1].ResourceURL  ' => "/man.png"

↑ Top of page ↑

Routings

Available from version 5.6.1.

Returns an Array of String.

Returns the description of the routing associated with that response with a simple assisted condition (one condition) using the “Has” operator

Examples
 gender.Responses[1].Routings ' => {"Show message Attention 1";"Show message Attention 3"}

↑ Top of page ↑

Scenarios

Available from version 5.6.1.

Returns an Array of String.

Examples
 gender.Responses[1].Scenarios ' => {"Scenario1";"Scenario2"}
 gender.Responses[1].Scenarios.Count  ' => "2"
 gender.Responses[1].Scenarios[2] ' => "Scenario2"

↑ Top of page ↑

Tags

Available from version 5.5.2.

Returns an Array of String.

Examples
 gender.Responses[1].Tags ' => {"tag1";"tag2"}
 gender.Responses[1].Tags.Count  ' => "2"
 gender.Responses[1].Tags[2] ' => "tag2"

↑ Top of page ↑

UserData

Available from version 5.6.1.

Returns a String.

Examples
 gender.Responses[1].UserData ' => Some user data

↑ Top of page ↑

Methods

InputName([type])

Available from version 5.3.3.

Returns the full name of the HTML input for this response.

For single questions, the input name of all responses is identical, and is equal to the input name of the question itself.

Returns a String.

Parameters
Examples

' Single
gender.InputName() ' => "U0"
gender.Responses[1].InputName() ' => "U0"
gender.Responses[2].InputName() ' => "U0"

 ' Multiple
brands.InputName() ' => "M2" 
brands.Responses[1].InputName() '=> "M2 510" 
brands.Responses[2].InputName() '=> "M2 511"
 ' Multiple with ranking
brands.InputName("ranking") ' => "R2" 
brands.Responses[1].InputName("ranking") '=> "R2 510" 
brands.Responses[2].InputName("ranking") '=> "R2 511"

↑ Top of page ↑

InputValue([type])

Available from version 5.3.3.

Returns the HTML input value attribute for this response.

For multiple questions, this method returns the non-shared part of the input name.

Returns a String.

Parameters
Examples

' Single

gender.Responses[1].InputValue() ' => "456" 
gender.Responses[2].InputValue() ' => "457"
 ' Multiple
brands.Responses[1].InputValue() ' => "510" 
brands.Responses[2].InputValue() ' => "511" 
' Where brands.Responses[2].InputName() => "M2 511"
 ' Multiple with ranking
brands.Responses[1].InputValue("ranking") ' => "2" 
brands.Responses[2].InputValue("ranking") ' => "1" 
' Where brands.Responses[2].InputValue() => "511"

↑ Top of page ↑

ToString()

Modified in version 5.3.3.

Returns a string which represents the response (expressed in JSON format).

Returns a String.

The "isSelected" key is available in version 5.3.3 onwards.
Example
 ' Output in a single line (it's break here for the readability)
gender.Responses[1].ToString() 
' => {
"index":1,
"entryCode":"001",
"caption":"Man",
"isExclusive":true,
"isSelected":true,
"resourceUrl":"./Man.png" 
}

↑ Top of page ↑

TypeOf()

Always returns "response".

Returns a String.

Example
gender.Responses[1].TypeOf() ' => "response"

↑ Top of page ↑

Operators

All operators for a Number type variable are available using the response object. In the case of the response object, the method will be executed on the Index of the response object. Please refer to the  Number type operators for details.

Example
brands.AvailabeResponses[1] + 2
' Equivalent to
' brands.AvailableResponses[1].Index + 2

↑ Top of page ↑

Create your own Knowledge Base