Interview object

In AskiaScript, the interview object is a predefined object that contains all the available information about the interview itself. This variable is in the global scope, so is available everywhere in AskiaScript.

In this topic:

Properties

AgentId

Available from version 5.4.2.

Returns the identifier of the interviewing agent.

Only available during askiaVoice or askiaFace fieldwork, otherwise it returns 0.

Returns a Number.

Example
Interview.AgentID  ' => 35

↑ Top of page ↑

AgentName

Available from version 5.4.2.

Returns the name of the interviewing agent.

Only available during askiaVoice or askiaFace fieldwork, this proprty otherwise returns an empty string ("").

Returns a String.

Example
Interview.AgentName  ' => "Jerome"

↑ Top of page ↑

ApplicationName

Available from version 5.5.3.4

Returns the name of the askia application.

The possible values:

Returns a String.

Example
Interview.ApplicationName  ' => "designoffline"

↑ Top of page ↑

Broker

Available from version 5.3.5.

Returns the name of the current broker (sample provider).

Returns a String.

Example
Interview.Broker ' => "Askia"

↑ Top of page ↑

BrokerPanelId

Available from version 5.3.5.

Returns the broker identifier of the current panelist.

Returns a String.

Example
Interview.BrokerPanelId ' => "Askia001"

↑ Top of page ↑

CallId

Available from version 5.4.2

Returns the Call ID of the current interview.

Only available during askiaVoice or askiaFace fieldwork, otherwise it returns 0.

Returns a Number.

Example
Interview.CallId ' => 123

↑ Top of page ↑

EndTime

Available from version 5.4.2.

Indicates the finished date/time of the current interview (eg. EndInterview).

If the current interview is not yet finished, this property returns the time that the last screen was submitted.

This method returns the time with the respondent offset.

Returns a Date.

Example
Interview.EndTime  ' => "25/11/2011 18:00:00"

↑ Top of page ↑

EndTimeUTC

Available from version 5.4.2

Indicates the finished date/time of the current interview in UTC (Coordinated Universal Time). If the current interview is not yet finished, this property returns the time that the last screen was submitted.

This property returns the time with the UTC offset.

Returns a Date.

Examples
Interview.EndTimeUTC  ' => "25/11/2011 17:00:00" (Respondent timezone is UTC+1)
Interview.EndTime  ' => "25/11/2011 18:00:00"

↑ Top of page ↑

Errors

Available from version 5.4.2

Returns the list of errors during the interview run-time

Returns Errors.

Examples
Interview.Errors.Count ' => 0
Interview.Errors[1].Message ' => "A response is expected for question 'q1'"

↑ Top of page ↑

GUID

Available from version 5.3.5

Returns the GUID (Global Unique IDentifier) of the current interview.

Example
Interview.GUID ' => "{D2CC3826-F124-460F-8CD7-5D5C4D7B86F2}"

↑ Top of page ↑

Id

Available from version 5.4.2

Id of the current interview (eg. IntvwId).

Returns a Number.

Example
Interview.Id ' => 123

↑ Top of page ↑

IPAddress

Available from version 5.3.5.

Returns the IPAddress of the current interviewer

Returns a String.

Example
Interview.IPAddress ' => "127.0.0.1"

↑ Top of page ↑

IsFace

Available from version 5.4.2.

Indicates whether the current interviewing mode is AskiaFace (CAPI, or face),

Returns a Boolean.

Example
Interview.IsFace  ' => True

↑ Top of page ↑

IsFirstPage

Available from version 5.4.2.

Indicates whether the page being displayed to the respondent is the first page.

Returns a Boolean.

Example
Interview.IsFirstPage  ' => true

↑ Top of page ↑

IsLastPage

Available from version 5.4.2.

Indicates whether the page being displayed to the respondent is the last page.

Return a Boolean.

Example
Interview.IsLastPage  ' => false

↑ Top of page ↑

IsTest

Available from version 5.4.2.

Indicates whether the current interview was started in Brief mode or with the Test flag set.

Returns a Boolean.

Example
Interview.IsTest ' => True

↑ Top of page ↑

IsVoice

Available from version 5.4.2.

Indicates whether the current interviewing mode is AskiaVoice (CATI or telephony).

Returns a Boolean.

Example
Interview.IsVoice  ' => True

↑ Top of page ↑

IsWeb

Available from version 5.4.2.

Indicates if the current interviewing mode is AskiaWeb (Web).

Returns a Boolean.

Example
Interview.IsWeb  ' => False

↑ Top of page ↑

Key

Available from version 5.4.2.

Returns the secure hash key of the current interview (used in URL) (eg. Password)

Returns a String.

Example
Interview.Key ' => "QWERTYQWERTYQWER"  False

↑ Top of page ↑

Language

Available from version 5.3.5.

Returns the current respondent language.

Returns a Language.

Examples
Interview.Language.Id ' => "1036"
Interview.Language.Abbr ' => "FRA"
Interview.Language.Name ' => "French (France)"
Interview.Language.DateFormat ' => "dd/MM/yyyy"
Interview.Language.DecimalSeparator ' => ","
Interview.Language.ThousandSeparator ' => " "

↑ Top of page ↑

LastResultCode

Available from version 5.4.9 January 2019.

Returns the Last result code to the call or web interview - this is only available in a routing at the end of the survey or on an edit routing

Returns a Number.

Example
Interview.LastResultCode ' => 4 = hang-up

For web interview:

FINISHED                               => 0

STARTED                               => 1000

ABANDONED                         => 1001

QUOTAFULL                          => 1002

SURVEYOFFLINE                    => 1003

FINISHED_WITHOUT_SAVING => 1004

SCREENED_OUT                    => 1005

SPEEDER                               => 1006

STRAIGHLINING                    => 1007

↑ Top of page ↑

LastSubResultCode

Available from version 5.4.9 January 2019.

Returns the Last sub result code to the call or web interview - this is only available in a routing at the end of the survey or on an edit routing

Returns a Number.

Example
Interview.LastSubResultCode ' => 3

↑ Top of page ↑

Latitude

Available from version 5.3.5.

Returns the geographical latitude of the respondent's device.

Returns a Number.

Example
Interview.Latitude ' => 47.3520544

↑ Top of page ↑

ListId

Available from version 5.4.2.

Returns the identifier of the respondent list.

Returns a Number.

Example
Interview.ListId ' => 2

↑ Top of page ↑

Longitude

Available from version 5.3.5.

Returns the geographical longitude of the respondent's device.

Returns a Number.

Example
Interview.Longitude ' => 3.3825492

↑ Top of page ↑

OutOfQuotaQuestions

Available from version 5.4.9.

Returns the question (or the list of questions if the quotas are nested) that triggered the out of quota - this is only available in a routing at the end of the survey or on an edit routing.

Returns a collection of questions.

Example
Interview.OutOfQuotaQuestions[1].Shortcut ' => Gender
Interview.OutOfQuotaQuestions[1].Value ' => 1 (Male)

↑ Top of page ↑

PanelId

Available from version 5.3.5.

Returns the identifier of the current panelist.

Returns a String.

Example
Interview.PanelId ' => 12345b

↑ Top of page ↑

PercentCompletion

Available from version 5.6.1.0

Returns the position level (as a percentage) of the current interview. It's the same behaviour as the .PercentPosition but the value never decrease so if we go back we keep the highest value

Returns a Number (0-100).

Example
Interview.PercentCompletion ' => 50

↑ Top of page ↑

PercentPosition

Available from version 5.5.3.6

Returns the position level (as a percentage) of the current interview.

Returns a Number (0-100).

Note: the .PercentPosition take into account the rest of the questions to ask. The .Progress take into account the rest of the variables to ask and also the previous questions with missing answers.

Example
Interview.PercentPosition ' => 50

↑ Top of page ↑

Progress

Available from version 5.3.5.

Returns the progress level (as a percentage) of the current interview (eg. PrctDone).

Returns a Number (0-100).

Note: the .PercentPosition take into account the rest of the questions to ask. The .Progress take into account the rest of the variables to ask and also the previous questions with missing answers.

Example
Interview.Progress ' => 50

↑ Top of page ↑

Quota

Available from version 5.6.0.

Returns the entire quota tree definition. You need to use .ToString() in order to return it in json format and use it in your script.

Example
Interview.Quota.ToString() ' => the entire quota tree definition in json format

↑ Top of page ↑

Scenario

Available from version 5.4.2.

Returns the current respondent scenario.

Returns a String.

Example
Interview.Scenario ' => "client"

↑ Top of page ↑

Seed

Available from version 5.3.5

Returns the seed of the current interview (unique identifier that is used to provide randomisation).

Returns a Number.

Example
Interview.Seed ' => 123

↑ Top of page ↑

ShowComments

Available from version 6.5.0

Could be used in a run an AskiaScript routing in order to control the visibility of the Comments on the screen.

Returns a boolean.

Example
Interview.ShowComments = (Question Has {2}) ' => 123

↑ Top of page ↑

ShowInstructions

Available from version 6.5.0

Could be used in a run an AskiaScript routing in order to control the visibility of the Instructions on the screen.

Returns a boolean.

Example
Interview.ShowInstructions = (Question Has {1}) ' => 123

↑ Top of page ↑

StartTime

Available from version 5.4.2

Indicates the start date/time of the current interview (eg. StartInterview). This property returns the time with the respondent offset.

Returns a Date.

Example
Interview.StartTime  ' => "25/11/2011 17:58:00"

↑ Top of page ↑

StartTimeUTC

Available from version 5.4.2.

Indicates the start date/time of the current interview in UTC (Coordinated Universal Time). This property returns the time with the UTC offset.

Returns a Date.

Examples
Interview.StartTimeUTC  ' => "25/11/2011 16:58:00" (Respondent timezone is UTC+1)
Interview.StartTime  ' => "25/11/2011 17:58:00"

↑ Top of page ↑

Methods

Abandon(exitCode[,subExitCode])

Proposal for version 5.X.

Marks the interview as abandoned. Equivalent to the routing action goto and mark as incomplete. This method is mostly used in conjunction with the GoTo methods.

Returns an Interview.

Parameters
Examples
Interview.GoTo(chapterNotRightPhoneNumber).Abandon(27)
 ' Example with EndOfSurvey keyword
' Abandon of the interview and go to the end of the survey
Interview.GoTo(EndOfSurvey).Abandon(13)
 ' Example with sub-exit code
Interview.Abandon(13, 1)

↑ Top of page ↑

Duration(startQuestion[, endQuestion][, threshold])

Available from version 5.4.2

Returns the time (in seconds) spent on a question, or the total time spent between a range of questions (e.g. InterviewTime).

WARNING: When a question is inside a loop, this function returns the time spent on the question at a given iteration. It does not return the time spent between the first and the last iteration.
Returns a Number.
Parameters
Examples
Interview.Duration(gender) ' => 2 (seconds)
Interview.Duration(gender, Age) ' => 5 (seconds)

q1 and q2 are inside the same loop

'Line 1. q1  Iteration 1 = 5s
'Line 2. q2  Iteration 1 = 3s
'Line 3. q1  Iteration 2 = 5s
'Line 4. q2  Iteration 2 = 3s
'Line 5. q1  Iteration 3 = 5s
'Line 6. q2  Iteration 3 = 3s

 

Interview.Duration(q1.Iteration(1)) ' => 5 (seconds) [Line 1]
Interview.Duration(q2.Iteration(1)) ' => 3 (seconds) [Line 2]
Interview.Duration(q1.FirstIteration, q1.LastIteration) ' => 21 (seconds) [Lines 1 to 5] it doesn't include the last iteration of q2 
Interview.Duration(q1.FirstIteration, q2.LastIteration) ' => 24 (seconds) [Lines 1 to 6]

↑ Top of page ↑

GetFaceOS()

Available from version 5.4.2.

Returns the Operating System (OS) of the AskiaFace device, if the current interviewing mode is AskiaFace. If the interviewing mode is not Face, this method returns an empty string.

Returns a String.

Possible return values are:

"windows"
"ios"
"android"
Parameters
Examples
Interview.GetFaceOS()  ' => "windows"
Interview.GetFaceOS()  ' => "ios"
Interview.GetFaceOS()  ' => "android"

↑ Top of page ↑

GoTo(targetQuestion)

Available from version 5.4.2.

Redirects the respondent to the specified question. Equivalent to the routing actions go to and go back to.

Warning: This method will not preserve answers between the source question of the routing and the target question. Consider using the method SetPosition if you want to preserve answers.

Returns an Interview.

This is available only when running R/W scripts, not when evaluating conditions.

Examples
Interview.GoTo(q2)
 ' Example with question inside the loop
' Go to the second iteration of the question inside the loop
Interview.GoTo(qInLoop.Iteration(2))
 ' Example with EndOfSurvey keyword
' Go to the end of the survey
Interview.GoTo(EndOfSurvey)
 ' Go to and abandon
If q1 Has {1} Then
   Interview.GoTo(q2).Abandon(3)
EndIf

↑ Top of page ↑

SetLanguage(languageAbbr or CultureInfo)

Available from version 5.4.2. for the language abbrevation and 5.6.1 for the culture info

Changes the language of the current interview. Equivalent to the routing action set language.

Returns the Interview object.

This is available only when running R/W scripts not when evaluating conditions
Parameters
Examples
Interview.SetLanguage("FRA")
' Interview.LanguageAbbr ' => "FRA"
 ' Example with calls chain
Interview.SetLanguage("fra").SetScenario("french")
Interview.SetLanguage("fr-FR")
' Interview.CultureInfo ' => "fr-FR"
 ' Example with calls chain
Interview.SetLanguage("fr-FR").SetScenario("french")

↑ Top of page ↑

SetPosition(targetQuestion)

Available from version 5.5.3

Redirects the respondent to the specified question. There is no equivelant routing action.

Returns an Interview.

This is available only when running R/W scripts not when evaluating conditions

This method differs from GoTo, as it will preserve all answers.
Examples
Interview.SetPosition(q2)
 ' Example with question inside the loop
' Go to the second iteration of the question inside the loop
Interview.SetPosition(qInLoop.Iteration(2))
 ' Example with EndOfSurvey keyword
' Go to the end of the survey
Interview.SetPosition(EndOfSurvey)

↑ Top of page ↑

SetScenario(name)

Available from version 5.4.2.

Change the scenario of the current interview. Equivalent to the routing action set current version.

Returns the Interview object.

This is available only when running R/W scripts not when evaluating conditions.
Parameters
Examples
Interview.SetScenario("administrator")
 ' Example with calls chain
Interview.SetScenario("user").SetLanguage("ENG")

↑ Top of page ↑

ToString()

Available from version 5.3.5.

Returns a string which represents the current Interview object (expressed in JSON format).

Returns a String.

' Output in a single line (it's broken in different lines here for readability)
Interview.ToString() 
' => {
"id" : 1,
"key" : "QWERTYQWERTYQWER",
"callId" : 1,
"seed" : 1,
"guid" : "{D2CC3826-F124-460F-8CD7-5D5C4D7B86F2}",
"startTime" : "3/25/2011 04:32:07 PM",
"endTime" : "3/25/2011 04:50:07 PM",
"agentId" : 1,
"agentName" : "Jerome",
"isTest" : true,
"mode": "capi",
"capiOS" : "ios",
"progress":100,
"pagePosition":10,
"pageCount":10,
"latitude" : 47.3520544,
"longitude" : 3.3825492,
"panelId" : 0,
"broker" : "",
"brokerPanelId" : "",
"listId" : 2,
"language" : "FRA",
"scenario" "administrator" 
}

↑ Top of page ↑

TypeOf()

Available from version 5.3.5.

Always returns "interview".

Returns a String.

Example
Interview.TypeOf() ' => "interview" 

↑ Top of page ↑

Exit codes

Telephony

Web

↑ Top of page ↑

Create your own Knowledge Base