Responses Collection type variable

In AskiaScript, the responses collection type variable contains a collection of responses; it is, in effect, an array of responses.

A responses collection type variable can be created through a closed question object (Responses, AvailableResponses and Answers properties).

↑ Top of page ↑

In this topic:

Accessor

[index]

The [index] is the accessor of response. It returns the response object at the specified index. This accessor property is used without the dot period (.), like an array accessor.

Returns a Response.

Parameters
Examples
gender.Responses[1]  ' => <Response::1#Man>
gender.Responses[2]  ' => <Response::2#Woman>

↑ Top of page ↑

Properties

Caption

Returns an array containing the captions of the responses in the referenced question.

Returns an Array of Strings.

Example
gender.Responses.Caption ' => {"Man"; "Woman"}

↑ Top of page ↑

Count

Returns the number of items in the collection.

Returns a Number.

Example
gender.Responses.Count ' => 2

↑ Top of page ↑

EntryCode

Returns an array containing the entry-codes of the responses in the referenced question, as numbers.

Returns an Array of Numbers.

Examples
brands.Responses.EntryCodeStr ' => {"001"; "002"; "003"}

brands.Responses.EntryCode ' => {1; 2; 3}

↑ Top of page ↑

EntryCodeStr

Returns an array containing the entry-codes of the responses in the referenced question.

Returns an Array of Strings.

Example
country.Responses.EntryCodeStr ' => {"US"; "UK"; "FR"}

↑ Top of page ↑

Factor

Available from version 5.4.6.

Returns an array of factors as entered in the value column of the scale responses.

Returns an array.

Examples

gender.Responses.Factor ' => 3;8

country.AvailableResponses.Factor ' => 7;3;8;6

↑ Top of page ↑

Index

Returns an array of responses indexes (based 1).

Returns an Array of Numbers.

Examples

gender.Responses.Index ' => {1; 2}

country.AvailableResponses.Index ' => {2; 3; 1}

↑ Top of page ↑

ResourceURL

Returns an array containing the URLs of any response resources in the referenced question.

Returns an Array of Strings.

Example
gender.Responses.ResourceURL  ' => {"/man.png"; "/woman.png"}

↑ Top of page ↑

Roots

Available from version 5.5.3.

Returns only the root list of responses/items so level 1.

Returns a collection of responses.

Example
CurrentQuestion.AvailableResponses.Roots

↑ Top of page ↑

Tags

Available from version 5.6.1.

Returns an array of strings.

Example
CurrentQuestion.Answers.Tags Has {"Luxury"} 

↑ Top of page ↑

Methods

FilterByTag(tags)

Available from version 5.6.1.

Return the list of all the responses with the tag provided as string or the list of tags provided as array of string.

Returns a Collection of Responses.

Parameter
Brands.Answers.FilterByTag("luxury") => 'Return the list of all responses given to the question brands with a tag luxury
Brands.Responses.FilterByTag({"beverage"; "luxury"}) => 'Return the list of all responses from the brands question with a tag beverage or luxury

↑ Top of page ↑

ToString()

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

Returns a String.

Example
 ' Output in a single line (it's broken here for the sake of readability)
gender.Responses.ToString() 
' => [{
"index":1,
"entryCode":"001",
"caption":"Man",
"isExclusive":true,
"resourceUrl":"./Man.png" 
},{
"index" : 2,
"entryCode":"002",
"caption":"Woman",
"isExclusive":true,
"resourceUrl":"./Woman.png" 
}]

 

↑ Top of page ↑

TypeOf()

Always returns "responses".

Returns a String.

Example
gender.Responses.TypeOf() ' => "responses" 

↑ Top of page ↑

Operators

The value(s) of the responses object could be a Number, a String or an Array. Please see the section on operators for each type for more details.

↑ Top of page ↑

Create your own Knowledge Base