Scroll

# Askia Analyse Script Appendix

Follow

Here is a summary of all the keyword types in Analyse and a rough indication of which parts of Analyse they can be used in:

 Type No. of keywords Since Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 Survey 5 5.5.2 ✔ ✔ ✔ ✔ ✔ 2 Question 24 5.3.5 ✔ ✔ ✔ ✔ ✔ 3 Response 7 5.3.5 ✔ ✔ ✔ ✔ ✔ 4 Responses 3 5.3.4 ✔ ✔ ✔ ✔ ✔ 5 QuestionArray 2 5.5.2 (✔) 6 Table 6 5.3.5 ✔ ✔ 7 Cell 14 5.3.5 (✔) ✔ 8 Data 18 5.3.5 ✔ ✔ ✔ ✔ ✔ 9 TabDef 7 5.5.2 (✔) 10 Portfolio 5 5.5.2 (✔) 11 PortfolioItem 5 5.5.3 (✔) 12 SubPopulation 4 5.5.3 (✔) 13 Profile 4 5.5.2 (✔) 14 ProfileItem 5 5.5.3 (✔) 15 ProfileQuestion 3 5.5.3 (✔) 16 Debug 1 5.3.5 ✔ ✔ ✔ ✔ 17 Array 25 5.3.2 ✔ ✔ ✔ ✔ ✔ 18 Date 13 5.3.2 ✔ ✔ ✔ ✔ ✔ 18 Number 16 5.3.2 ✔ ✔ ✔ ✔ ✔ 20 String 29 5.3.2 ✔ ✔ ✔ ✔ ✔ 21 Global (Analyse) 13 5.3.5 ✔ ✔ (✔) (✔)

 Survey keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 ChildQuestions 5.5.2 QuestionArray ✔ ✔ ✔ ✔ ✔ 2 Directory 5.5.2 String ✔ ✔ ✔ ✔ ✔ 3 Levels 5.5.2 QuestionArray ✔ ✔ ✔ ✔ ✔ 4 Name 5.5.2 String ✔ ✔ ✔ ✔ ✔ 5 Questions 5.5.2 QuestionArray ✔ ✔ ✔ ✔ ✔

# ChildQuestions

Returns the lists of top level questions (often chapters) e.g.

`	Survey.ChildQuestions[1]`

# Directory

Returns the directory where the survey file is e.g.

`	Survey.Directory        ' => "C:\Qes\ThisSurvey\"`

# Levels

Returns the lists of levels (not the interview level) e.g.

`	Survey.Levels[2].Shortcut	' => BrandLoop`

# Name

Returns the name of the survey e.g.

`	Survey.Name        ' => "Ex.qes"`

# Questions

Returns the array of all questions - understand that per question we mean each survey data point - so a question within a loop will appear many times e.g.

`	Survey.Questions[1].Shortcut ' => "Demographics"`

## ...[return to top of 'Survey' section]

 Question keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 ChildQuestions 5.5.2 QuestionArray ✔ ✔ ✔ 2 Children 5.3.5 QuestionArray ✔ ✔ ✔ 3 Data 5.3.5 Data ✔ ✔ ✔ ✔ ✔ 4 DevelopedQuestions 5.5.2 QuestionArray ✔ ✔ ✔ 5 IsCalculated 5.5.2 Boolean ✔ ✔ ✔ ✔ ✔ 6 IsCoding 5.5.3 Boolean ✔ ✔ ✔ ✔ ✔ 7 IsDeveloped 5.5.2 Boolean ✔ ✔ ✔ ✔ ✔ 8 IsVisibleDuringDataEntry 5.5.3 Boolean ✔ ✔ ✔ ✔ ✔ 9 LongCaption 5.3.5 String ✔ ✔ ✔ ✔ ✔ 10 MaxDate 5.3.5 Date ✔ ✔ ✔ ✔ ✔ 11 MaxValue 5.3.5 Number ✔ ✔ ✔ ✔ ✔ 12 MinDate 5.3.3 Date ✔ ✔ ✔ ✔ ✔ 13 MinValue 5.3.3 Number ✔ ✔ ✔ ✔ ✔ 14 NextQuestion 5.3.5 Question ✔ ✔ ✔ ✔ ✔ 15 Parent 5.3.5 Question ✔ ✔ ✔ ✔ ✔ 16 PreviousQuestion 5.3.5 Question ✔ ✔ ✔ ✔ ✔ 17 Responses 5.3.5 Responses ✔ ✔ ✔ ✔ ✔ 18 ShortCaption 5.3.5 String ✔ ✔ ✔ ✔ ✔ 19 Shortcut 5.3.5 String ✔ ✔ ✔ ✔ ✔ 20 Tags 5.5.0 StringArray ✔ ✔ ✔ ✔ ✔ 21 ToEntryCodeStr 5.4.5 Variant ✔ ✔ ✔ ✔ ✔ 22 ToString 5.5.2 String ✔ ✔ ✔ ✔ ✔ 23 Type 5.5.2 String ✔ ✔ ✔ 24 Value 5.5.2 Number ✔ ✔ ✔ ✔ ✔

...[return to top]

# ChildQuestions

Returns the lists of questions just below the object question e.g.

`	Chapter1.ChildQuestions[1]`

# Children

Returns all the sub-questions associated to a question - that is all the questions placed within the sub-tree defined by a question. It's also known as the Developed Questions e.g.

`	 Dim arrSubQuestions = BrandEvaluation.Children`

# Data

Returns the data for a given question - could be numeric, closed or open e.g.

`gender.Data.Counts()[1] ' => Counts for first response`

# DevelopedQuestions

Returns the lists of questions in the interview level related to that question e.g.

`	BrandRatingGRID.DevelopedQuestions[1]`

# IsCalculated

Indicates if a question is calculated or not e.g.

`	gender.IsCalculated ' => False`

# IsCoding

Indicates if a question is a coding (groups, levels, discrete values)

`	gender.IsCoding ' => False`

# IsDeveloped

Indicates if a question is developed - that is does it come from a question inside a loop associated to one ore more loop items

`	^RatingBrandGrid (Pepsi)^.IsDeveloped ' => True`

# IsVisibleDuringDataEntry

Indicates if a question is visible to interviewees during collection e.g.

`	gender.IsVisibleDuringDataEntry ' => False`

# LongCaption

Returns the long caption of the question in the current language e.g.

`gender.LongCaption ' => "Are you a:"`

# MaxDate

Indicates the maximum expected for a date question. When no maximum is expected it returns DK e.g.

``` ' Date question with maximum date "31/12/2013"
MyDate.MaxDate  ' => #31/12/2013#
' Date question without maximum value
MyDate.MaxDate  ' => DK```

# MaxValue

Indicates the maximum expected for the question. When no maximum is expected it return DK

• It's the maximum number of allowed responses for closed question.
• It's the maximum expected value for a numeric question.
• It's the maximum expected length for an open-ended question.
``` ' Multi-coded question with maximum 5 responses
Brands.MaxValue  ' => 5
' Numeric question with 99 as minimum value
age.MaxValue  ' => 99
' Open-ended question with 5 maximum characters
postalCode.MaxValue ' => 5
' Question without maximum value
CurrentQuestion.MaxValue ' => DK```

# MinDate

Indicates the minimum expected for a date question. When no minimum is expected it return DK e.g.

``` ' Date question with minimum date "01/01/2013"
MyDate.MinDate  ' => #01/01/2013#
' Date question without minimum value
MyDate.MinDate  ' => DK```

# MinValue

Indicates the minimum expected for the question. When no minimum is expected it return DK e.g.

• It's the minimum number of allowed responses for closed question.
• It's the minimum expected value for a numeric question.
• It's the minimum expected length for an open-ended question.
``` ' Multi-coded question with minimum 3 responses
Brands.MinValue  ' => 3

' Numeric question with 18 as minimum value
age.MinValue  ' => 18

' Open-ended question with 5 minimum characters
' This example is currently fictional because the
' system doesn't have a minimum length value
' for open-ended question
postalCode.MinValue ' => 5

' Question without minimum value
CurrentQuestion.MinValue ' => DK```

# NextQuestion

Returns the next question in the tree (below or after) e.g.

`	 Dim NextQuetsion = BrandEvaluation.NextQuestion`

# Parent

Returns the parent question in the survey tree in analyse/vista e.g.

`	 Dim LoopQuestion = BrandEvaluation.Parent`

# PreviousQuestion

Returns the previous question in the tree (before or above) e.g.

`	 Dim BeforeQuetsion = BrandEvaluation.PreviousQuestion`

# Responses

Returns the entire list of responses for a closed question e.g.

``` Color.Responses
Design definition: Shortcut: Color, Type: Multiple, Rotation: yes random, LongCaption: Which color do you like?
List of responses:
Red
Blue
Green
Purple

Screen visible by the respondent
(The Blue response was hidden using a routing ignore responses):
Which color do you like?
Green
Red
Purple

The responses selected by the respondent are Purple and Red in this order
(the EntryCode of Red is 11, Blue is 12, Green is 13 and Purple is 14)

Color.Responses.Value will return 1;2;3;4
Color.Responses.EntryCode will return 11;12;13;14
Color.Responses.Caption will return Red;Blue;Green;Purple
Color.Responses[2].Value will return 2 (the second answer available)```

# ShortCaption

Returns the short caption of the question in the current language. If the ShortCaption is empty then it returns the LongCaption e.g.

`gender.ShortCaption ' => "Respondent Gender"`

# Shortcut

Returns the shortcut of the question (name of the variable) e.g.

``` gender.Shortcut  ' => "gender"
^1. appreciation^.Shortcut   ' => "1. appreciation"```

# Tags

Returns the list of tags associated to a question e.g.

`	q1.Tags Has {"Browsable"}  = >True`

# ToEntryCodeStr

Returns the response as an entry code for closed question. It returns a string if the question is single, an array of string is the question is multiple.

It's the default property which is added when you compare a question to a string

` q1 Has {"1"} is transformed into q1.ToEntryCodeStr() Has {"1"}`
e.g.
```	gender.ToEntryCodeStr ' => "1"
brands.ToEntryCodeStr ' => {"3"; "5"; "6"}

' When no value specified:

gender.value ' => DK
age.value ' => DK
brands.value ' => {}
q1_other.value ' => ""
birthday.value ' => DK```

# ToString

Returns a string which represent the question object (expressed in JSON format) e.g.

``` ' Output in a single line (it's shown broken here for readability)
gender.ToString()
' => {
"shortcut":"gender",
"shortCaption":"Respondent gender",
"longCaption":"Are you?",
"type":"single"
}

' Output in a single line (it's shown broken here for readability)
' q1 is in loop of loop
q1.ToString()
' => {
"shortcut":"q1",
"shortCaption":"Q1",
"longCaption":"Q1",
"type":"single",
"iterations":{"parentLoop":4,"subLoop":2}
}```

# Type

Returns the type of the question as string e.g.

``` gender.Type ' => "single"
brands.Type ' => "multiple"
age.Type ' => "numeric"
comment.Type ' => "open"
birth.Type ' => "datetime"
```

# Value

Returns the basic value(s) (answers) of the question in the current iteration. When there is no response the value returned is DK e.g.

```	gender.value ' => 1
age.value ' => 33
brands.value ' => {3; 5; 6}
q1_other.value ' => "bla bla bla"
birthday.value ' => #14/02/1978#

' When no value specified:

gender.value ' => DK
age.value ' => DK
brands.value ' => {}
q1_other.value ' => ""
birthday.value ' => DK```

## ...[return to top of 'Question' section]

 Response keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 Caption 5.3.5 String ✔ ✔ ✔ ✔ ✔ 2 EntryCode 5.4.6 Number ✔ ✔ ✔ ✔ ✔ 3 EntryCodeStr 5.3.5 String ✔ ✔ ✔ ✔ ✔ 4 Factor 5.3.5 Number ✔ ✔ ✔ ✔ ✔ 5 Index 5.5.3 Number ✔ ✔ ✔ ✔ ✔ 6 Tags 5.5.2 StringArray ✔ ✔ ✔ ✔ ✔ 7 ToString 5.3.5 String ✔ ✔ ✔ ✔ ✔

...[return to top]

# Caption

Returns the caption of the response e.g.

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

# EntryCode

Returns the entry code as a number e.g.

`	gender.Responses[1].Entrycode ' => 1`

# EntryCodeStr

Returns the entry code as a string e.g.

`	gender.Responses[1].EntryCodeStr ' => "M"`

# Factor

Returns a factor as their was entered in the value column of the scale responses e.g.

` Agreement.Responses[5].Factor ' => 1`

# Index

Returns the index of the response e.g.

`gender.Responses[1].Index ' => 1`

# Tags

Returns the list of tags associated to a question e.g.

`	q1.Responses[1].Tags Has {"Main Brand"}  = >True`

# ToString

Returns a string which represent the response (express in JSON format) e..g.

``` ' 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"
}```

## ...[return to top of 'Response' section]

 Responses keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 Caption 5.3.5 StringArray ✔ ✔ ✔ ✔ ✔ 2 Index 5.5.3 Array ✔ ✔ ✔ ✔ ✔ 3 ToString 5.3.5 String ✔ ✔ ✔ ✔ ✔

...[return to top]

# Caption

Returns an array with the caption of responses in the collection e.g.

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

# Index

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

# ToString

Returns a string which represent the response collection (express in JSON format) e.g.

``` ' Output in a single line (it's break here for the 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"
}]```

## ...[return to top of 'Responses' section]

 QuestionArray keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 FilterByTag 5.5.2 QuestionArray (✔) 2 FindByShortcut 5.5.2 Question (✔)

...[return to top]

# FilterByTag

Returns an array of questions who have been tagged with one of the parameters e.g.

`	Survey.Questions.FilterByTag({"Likert"; {"Scale"})`

# FindByShortcut

Returns one question having the specified shortcut - if the question is not found, a dummy question is returned with a questionID = DK e.g.

`	Survey.Questions.FindByshortcut("Gender")        Survey.Questions.FindByshortcut("Gender").Shortcut ' => "Gender"`

## ...[return to top of 'QuestionArray' section]

 Table keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 GetCell 5.3.5 Cell ✔ ✔ 2 GetColSigLetter 5.3.5 String ✔ ✔ 3 MaxX 5.3.5 Number ✔ ✔ 4 MaxY 5.3.5 Number ✔ ✔ 5 StartX 5.3.5 Number ✔ ✔ 6 StartY 5.3.5 Number ✔ ✔

...[return to top]

# GetCell

Allows you to access the relevant cell and to read or modify its content where possible. Returns the Cell object.

## Parameters:

• X - Number - indicating which column (from 1) you want to use
• Y - Number - indicating which row (from 1) you want to use
`	Dim strTitle = CurrentTable.GetCell(1,1).Text`

# GetColSigLetter

Allows you to associate a column to a letter so you can display col-sig letter calculated by hand. Returns a String. Strength output for second parameter:

• -1 : -a
• -2 : -A
• -3 : -A+
• 1 : a
• 2 : A
• 3 : A+

## Parameters:

• X - Number - indicating which column (1 based) you want to use
• Strength - Number (Optional) - indicating how you want the col-sig letter to appear (2 is the default)

e.g.

```	Dim strThisCol = CurrentTable.GetColSigLetter( CurrentCell.X )
Dim strThisColVerySig = CurrentTable.GetColSigLetter( CurrentCell.X , 3 )```

# MaxX

Indicates the last column number in your table (the width). Returns Number e.g.

```	Dim i
For i = 1 to CurrentTable.MaxX
Next i```

# MaxY

Indicates the last row number in your table (the height). Returns Number e.g.

```	Dim j
For j = 1 to CurrentTable.MaxY
Next j```

# StartX

Indicates the first column number after the titles (question, response, row sig, calculation captions) i.e. the first column where there is data e.g.

```	Dim i
For i = CurrentTable.StartX to CurrentTable.MaxX
Next i```

# StartY

Indicates the first row number after the titles (question, response, col sig, calculation captions) i.e. the first row where there is data e.g.

```	Dim j
For j = CurrentTable.StartY to CurrentTable.MaxY
Next j```

## ...[return to top of 'Table' section]

 Cell keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 Column 5.3.5 ProfileItem ✔ ✔ 2 Edges 5.3.5 ProfileItemArray ✔ ✔ 3 Row 5.3.5 ProfileItem ✔ ✔ 4 SetBackColor 5.3.5 Cell (✔) 5 SetBold 5.3.5 Cell (✔) 6 SetForeColor 5.3.5 Cell (✔) 7 SetItalic 5.3.5 Cell (✔) 8 SetText 5.3.5 Cell (✔) 9 SetUnderline 5.3.5 Cell (✔) 10 SetValue 5.3.5 Cell (✔) 11 Text 5.3.5 String ✔ ✔ 12 Value 5.3.5 Number ✔ ✔ 13 X 5.3.5 Number ✔ ✔ 14 Y 5.3.5 Number ✔ ✔

...[return to top]

# Column

Returns the ProfileItem associated with the cell e.g.

`	CurrentCell.Column.Caption ' => Returns "Male" if gender is the question placed in columns`

# Edges

Returns the ProfileItems associated with the cells - note that because you can have nested edges, you can have more than one Edge for a cell whereas you only have one row and one column e.g.

`	CurrentCell.Edges[1].Caption ' => Returns "Male" if gender is the question placed in edges`

# Row

Returns the ProfileItem associated with the cell in the row e.g.

`	CurrentCell.Row.Caption ' => Returns "Male" if gender is the question placed in rows`

# SetBackColor

Allows you to set the backcolour of a cell. You can use the name of the colour, its html/RGB notations or also a number like 0. It returns the Cell object.

## Parameters:

• Color (String or Number(s)) - indicate which colour you want to use
```	CurrentTable.GetCell(1,1).SetBackColor("blue")
CurrentTable.GetCell(1,1).SetBackColor("#00ff00").SetBold()
CurrentTable.GetCell(1,1).SetBackColor(0)        CurrentTable.GetCell(1,1).SetBackColor(134,25,35)```

# SetBold

Allows you to set the font of a cell to bold. It returns the Cell object.

## Parameters:

• IsBold (Number) (Optional) - indicate if you want to set or remove the setting (true by default)
```	CurrentTable.GetCell(1,1).SetBold(True)
CurrentTable.GetCell(1,1).SetForeColor("#00ff00").SetBold()```

# SetForeColor

Allows you to set the forecolour of a cell. You can use the name of the colour, its html/RGB notations or also a number like 0. It returns the Cell object.

## Parameters:

• Color (String or Number(s)) - indicate which colour you want to use
```	CurrentTable.GetCell(1,1).SetForeColor("blue")
CurrentTable.GetCell(1,1).SetForeColor("#00ff00").SetBold()
CurrentTable.GetCell(1,1).SetForeColor(0)        CurrentTable.GetCell(1,1).SetForeColor(134,25,35)```

# SetItalic

Allows you to set the font of a cell to italic. It returns the Cell object.

Parameters:

• IsItalic (Number) (Optional) - indicate if you want to set or remove the setting (true by default)
```	CurrentTable.GetCell(1,1).SetItalic(True)
CurrentTable.GetCell(1,1).SetForeColor("#00ff00").SetItalic()```

# SetText

Allows you to change the text in a cell. It returns the Cell object.

## Parameters:

```    If  CurrentTable.GetCell(10,3).Value < 5 Then
CurrentTable.GetCell(10,3).SetText("not available")
EndIf```

# SetUnderline

Allows you to set the font of a cell to underline. It returns the Cell object.

## Parameters:

• IsUnderline (Number) (Optional) - indicate if you want to set or remove the setting (true by default)
```	CurrentTable.GetCell(1,1).SetUnderline(True)
CurrentTable.GetCell(1,1).SetForeColor("#00ff00").SetUnderline()```

# SetValue

Allows you to change the value in a cell - if you want to format it in a different way, use SetText. It returns the Cell object.

## Parameters:

`	CurrentTable.GetCell(10,3).SetValue(17)`

# Text

Returns (String type) the text or the formatted value of a cell. e.g.

`	Dim strText = CurrentCell.Text`

# Value

Returns the numeric value of a cell. If you ask for the value of a caption (question, response, ...) you will get a number indicating the internal number of the string e.g.

`	Dim dCounts = CurrentCell.Value`

# X

Returns the X position of a cell (that is its column number) (1-based starting at the top left cell title) e.g.

`	On(CurrentCell.X, 10, 20,30, 40)`

# Y

Returns the Y position of a cell (that is its row number) (1-based starting at the top left cell title) e.g.

`	On(CurrentCell.Y, 10, 20,30, 40)`

## ...[return to top of 'Cell' section]

 Data keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 Counts 5.3.5 Array ✔ ✔ ✔ ✔ ✔ 2 Filter 5.3.5 Data ✔ ✔ ✔ ✔ ✔ 3 FilterByColumn 5.3.5 Data ✔ ✔ 4 FilterByEdge 5.3.5 Data ✔ ✔ 5 FilterByX 5.3.5 Data ✔ ✔ 6 FilterByXY 5.3.5 Data ✔ ✔ 7 FilterByY 5.3.5 Data ✔ ✔ 8 MakeNumeric 5.3.5 Data ✔ ✔ ✔ ✔ ✔ 9 Max 5.3.5 Number ✔ ✔ ✔ ✔ ✔ 10 Mean 5.3.5 Number ✔ ✔ ✔ ✔ ✔ 11 Median 5.3.5 Number ✔ ✔ ✔ ✔ ✔ 12 Min 5.3.5 Number ✔ ✔ ✔ ✔ ✔ 13 Size 5.3.5 Number ✔ ✔ ✔ ✔ ✔ 14 SplitToNumbers 5.3.5 Data ✔ ✔ ✔ ✔ ✔ 15 StdDev 5.3.5 Number ✔ ✔ ✔ ✔ ✔ 16 StdDevEst 5.3.5 Number ✔ ✔ ✔ ✔ ✔ 17 Sum 5.3.5 Number ✔ ✔ ✔ ✔ ✔ 18 Weight 5.3.5 Data ✔ ✔ ✔ ✔ ✔

...[return to top]

# Counts

Returns an array of counts for the question... in one call you have the flat counts for a whole question. You have the possibility of creating groups of responses (which would be useful for multiple responses)

## Parameters:

• Group1 - Array (Optional)
• Group2 - Array (Optional)
``` gender.Data.Counts()[1] ' => 159 males
Brands.Data.Counts({1;5}, {2;4;6})[2] ' => Returns the number of individuals who have selected brands 2,4 or 6
```

# Filter

Filters some data with a sub-population. Returns Data.

## Parameters:

• Sub-population (String) - Give the name of a pre-existing sub-population to filter by.
``` gender.Data.Filter("Males").Counts()[2] ' => 0 females

Dim myVar = gender.Data
myVar.Filter("Males") ' This will change the sub-population in the variable
```

# FilterByColumn

Allows you to filter the data by which response is in the column the relevant weighting, sub-population and universe are applied.

## Parameters:

• X - Number (Optional) - parameter indicating which column (1-based) you want to use - or the current column if unspecified
```	CurrentCell.Row.Question.Data.FilterByColumn().Size ' => Returns the number of males if we are in the relevant column
CurrentCell.Row.Question.Data.FilterByColumn(CurrentTable.StartX + 1).Size ' => Returns the number of males if we are in the relevant column```

# FilterByEdge

Allows you to filter the data by which response is in the edge. The relevant weighting, sub-population and universe are applied

## Parameters:

• X - Number (Optional) - parameter indicating which column (1-based) you want to use - or the current column if unspecified
```	CurrentCell.Row.Question.Data.FilterByEdge().Size ' => Returns the edge total for the current column
CurrentCell.Row.Question.Data.FilterByEdge(5).Size ' => Returns the edge total for 5th column```

# FilterByX

Allows you to filter the data by the relevant column and edge item - in other words give you the base for that column. The relevant weighting, sub-population and universe are applied.

## Parameters:

• X - Number (Optional) - parameter indicating which column (1-based) you want to use - or the current column if unspecified
```	CurrentCell.Row.Question.Data.FilterByX().Size ' => Returns the overall total for the current column
CurrentCell.Row.Question.Data.FilterByX(5).Size ' => Returns the overall total for 5th column```

# FilterByXY

Allows you to filter the data by the relevant row, column and edge item - in other words give you the counts for that cell. The relevant weighting, sub-population and universe are applied

## Parameters:

• X - Number (Optional) - parameter indicating which column (1-based) you want to use - or the current column if unspecified
• Y - Number (Optional) - parameter indicating which row (1-based) you want to use - or the current row if unspecified
```	CurrentCell.Row.Question.Data.FilterByXY().Size ' => Returns the overall total for the current cell
CurrentCell.Row.Question.Data.FilterByXY(5,8).Size ' => Returns the overall total for cell 5 to the right, 8 down```

# FilterByY

Allows you to filter the data by the relevant row item - in other words give you the base for that row. The relevant weighting, sub-population and universe are applied

## Parameters:

• Y - Number (Optional) - parameter indicating which row (1-based) you want to use - or the current row if unspecified
```	CurrentCell.Row.Question.Data.FilterByY().Size ' => Returns the overall total for the current row
CurrentCell.Row.Question.Data.FilterByY(5).Size ' => Returns the overall total for 5th row```

# MakeNumeric

Transforms closed data into numeric data by providing a factor for each closed response. If the factors are not provided, the factors defined in Design are used.

## Parameters:

``` gender.Data.MakeNumeric(1,2,0,0).Mean()
Income.Data.MakeNumeric().Mean()
```

# Max

Returns the maximum (number) of all responses to a numeric question e.g.

` Age.Data.Max() ' => Max`

# Mean

Returns the mean of a numeric question e.g.

` Age.Data.Mean() ' => average age`

# Median

Returns the Median of a numeric question

## Parameters:

• IsInterpolated (Boolean) - indicates if we use interpolation to calculate the mean of the two middle observations and return their mean as the median value.
``` Age.Data.Median(true) ' => median age using interpolation if the number of interviews is even
```

# Min

Returns the minimum (number) of all responses to a numeric question e.g.

` Age.Data.Min() ' => Min `

# Size

Returns the weighted number of interviews in a Data object e.g.

``` Age.Data.Size() ' => Number of interviews
Age.Data.Weight("UKPopulation").Filter("Males").Size() ' => Returns the weighted number of males in the UK
```

# SplitToNumbers

Returns an array of data from an open question which data is formed like this:

• Interview 1 "1;2;10"
• Interview 2 "2;5;15"
• Interview 3 "3;8;20"

Question.Data.SplitToNumbers(2,";") would return a data object formed of 2,5 and 8

This should only be used on an open-ended question.

## Parameters:

`OpenEnded.Data.SplitToNumbers(2,";")  ' =>  {2;5;8}`

# StdDev

Returns the standard deviation of a numeric question e.g.

``` Age.Data.StdDev() ' => Standard deviation of age
```

# StdDevEst

Returns the standard deviation (estimator) of a numeric question - in other words the denominator of the variance is N-1 e.g.

``` Age.Data.StdDevEst() ' => Standard deviation of age
```

# Sum

Returns the sum of all responses to a numeric question e.g.

``` Age.Data.Sum() ' => Sum
```

# Weight

Adds weighting to a data container.

## Parameters:

• Weighting - String - Give the name of a pre-existing weighting to weight the data by.
``` Age.Data.Weight("UKPop").Mean() => Returns the weighted mean
Age.Data.Weight("UKPop").Filter("Males").Mean() => Returns the weighted mean for males

Dim myVar = Age.Weight
myVar.Weight("UKPop") ' This will change the weighting in the variable

```

## ...[return to top of 'Data' section]

 TabDef keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 Columns 5.5.2 Profile (✔) 2 Edges 5.5.2 Profile (✔) 3 Level 5.5.2 String (✔) 4 ReadTabTemplate 5.5.2 MethodResult (✔) 5 Rows 5.5.2 Profile (✔) 6 SetSubPopulation 5.5.2 TabDef (✔) 7 Weighting 5.5.2 String (✔)

...[return to top]

# Columns

Returns the profile defining the columns of a cross-tab e.g.

`	Portfolio.Items[1].TabDef.Columns.AddQuestion(Gender)`

# Edges

Returns the profile defining the edges of a cross-tab e.g.

`	Portfolio.Items[1].TabDef.Edges.AddQuestion(Gender)`

# Level

Sets or returns the name (string) of the level used in the TabDef. The level is identified by the shortcut of the level. If the string is empty, the level is "All interviews" e.g.

`	myTabDef.Level ="PeopleInHouseHold"`

# ReadTabTemplate

Reads a tab-template form the library

## Parameters:

• Path - String - indicates the name of the tab-template in the library
```	Dim myTabDef as TabDef
Dim res = myTabDef.ReadTabTemplate("Col-sig")
return res.Success```

# Rows

Returns the profile defining the rows of a cross-tab e.g.

`	Portfolio.Items[1].TabDef.Rows.AddQuestion(Gender)`

# SetSubPopulation

Sets the sub-population by name or object (if empty all interviews are selected). Returns the TabDef object e.g.

```	Dim TabDef1 as TabDef
TabDef1.SetSubPopulation("Males")```

# Weighting

Sets or returns the name of the weighting used in the TabDef. If the string is empty, the weighing is "No weighting" e.g.

`	myTabDef.Weighting ="NatRep"`

## ...[return to top of 'TabDef' section]

 Portfolio keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 Add 5.5.2 Portfolio (✔) 2 Items 5.5.2 PortfolioItems (✔) 3 Open 5.5.2 Portfolio (✔) 4 Read 5.5.2 MethodResult (✔) 5 Save 5.5.2 MethodResult (✔)

...[return to top]

# Add

Adds an item to a portfolio and returns portfolio.

## Parameters:

```	Dim myPortfolio as Portfolio
Dim myItem as PortfolioItem
myPortfolio.Add(myItem)```

# Items

Returns the list of portfolio items to iterate through and select by index e.g.

```	Dim myPortfolio as Portfolio
myPortfolio.Items[3].SetTitle("Tab Definition 3")```

# Open

Opens a portfolio e.g.

```	Dim myPortfolio as Portfolio
myPortfolio.Read("Example.xml")
myPortfolio.Open()```

# Read

Reads a portfolio definition from a file

## Parameters:

• Path - String - indicates the path to the portfolio
• IsForClones - Boolean - to indicate if it's for cloning of its settings (then the questions are not read). The questions will be read if the parameter is False.
```	Dim myPortfolio as Portfolio
Dim res = myPortfolio.Read("C:\MyPortfolios\definition.xml" , False)
return res.Success```

# Save

Saves a portfolio definition to a file

## Parameters:

• Path - String - indicates the path
```	Dim myPortfolio as Portfolio
Dim res = myPortfolio.Read("C:\MyPortfolios\Definition.xml")
res = myPortfolio.Save("C:\MyPortfolios\NewDefinition.xml")
return res.Success```

## ...[return to top of 'Portfolio' section]

 PortfolioItem keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 SetTabDef 5.5.2 PortfolioItem (✔) 2 SetTitle 5.5.2 PortfolioItem (✔) 3 SetType 5.5.2 PortfolioItem (✔) 4 TabDef 5.5.2 TabDef (✔)

...[return to top]

# SetTabDef

Sets the tab definition for a portfolio

## Parameters:

`Dim ScaledPortfolio As PortfolioScaledPortfolio.Read("Scaled.xml",True)Dim myPortfolio as PortfoliomyPortfolio.Items[1].SetTabdef(ScaledPortfolio.Items[2].TabDef)`

# SetTitle

Sets the title (string) for a portfolio e.g.

```	Dim myPortfolio as Portfolio
myPortfolio.Items[1].SetTitle("Chapter 1")```

# SetType

Sets the type of a portfolio item using a number parameter:

• 0 : Chapter
• 1 : Tab Definition
• 2 : Table of Contents
• 3 : External File (xls)
```	Dim myPortfolio as Portfolio
Portfolio.Items[1].SetType(1)```

# TabDef

Returns the definition of a tab-definition e.g.

`	Portfolio.Items[1].TabDef.Rows.AddQuestion(Gender)`

## ...[return to top of 'PortfolioItem' section]

 SubPopulation keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 Description 5.5.2 String (✔) 2 Name 5.5.2 String (✔) 3 Save 5.5.2 MethodResult (✔) 4 Script 5.5.2 String (✔)

...[return to top]

# Description

Returns the description (string) of a sub-population e.g.

```	SubPopulation.Name ="All males"
SubPopulation.Description ="All males interviewed in this wave"```

# Name

Sets or returns the name (string) of a sub-population e.g.

`	SubPoplation.Name ="All males"`

# Save

Saves a sub-population in the survey. If a sub-population has the same name, it will be replaced by this one e.g.

```	Dim mySP as SubPopulation
mySP.Name ="All males"
mySP.Script ="Gender has {1}"
Dim res = mySP.Save()
return res.Success```

# Script

Returns the script of a sub-population e.g.

```	SubPopulation.Name ="All males"
SubPopulation.Script ="Gender has {1}"```

## ...[return to top of 'SubPopulation' section]

 Profile keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 Add 5.5.2 Profile (✔) 2 Clear 5.5.2 Profile (✔) 3 Clone 5.5.2 Profile (✔) 4 ProfileQuestions 5.5.2 ProfileQuestions (✔)

...[return to top]

# Add

This can add in three different ways always returning the profile object.

• Adds a profile to a another profile
• Adds a question to a profile and selects the specified responses (if nothing specified all responses are selected)
• Adds a profile question to a profile

## Parameters:

```        Dim myTab as CrossTab
myTab.Rows.Add(myProfile)```
```        Dim myTab as CrossTab
myTab.Rows.Add(Gender)```
```	Dim myTab as CrossTab
Dim myQuestion As ProfileQuestion
myQuestion.Question = Gender
myTab.Rows.Add(myQuestion)```

# Clear

Clears a profile of all the questions in it e.g.

`	resItem.TabDef.Rows.Clear()`

# Clone

Returns a profile cloned with the question received as a parameter

## Parameters:

• Question - Question - to be cloned according to the presentation held in the profile
`	resItem.TabDef.Rows.Add ( ClosedPortfolio.Items[1].TabDef.Rows.Clone(currQuestion) )`

# ProfileQuestions

Returns an array of profile questions e.g.

`	Portfolio.Items[1].TabDef.Rows.ProfileQuestions[1]`

## ...[return to top of 'Profile' section]

 ProfileItem keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 Caption 5.5.3 String (✔) 2 Response 5.5.3 Number (✔) 3 Script 5.5.3 String (✔) 4 Selected 5.5.3 Boolean (✔) 5 Type 5.5.3 Number (✔)

...[return to top]

# Caption

Sets or returns the caption as a string for a question e.g.

```	dim myGroup As ProfileItem
myGroup.Caption ="Total"```

# Response

Sets or returns the response (number) for that item e.g.

```	Dim myItem as ProfileItem
myItem.Response = 1 ```

# Script

Sets or returns the script of a calculated response e.g.

```	dim myCalc As ProfileItem
myCalc.Caption ="Calc"
myCalc.Script ="{1} - {2}"```

# Selected

Sets or returns if a response is visible (boolean) in the tab def (Group and hide) e.g.

```	dim myCalc As ProfileItem
myCalc.Selected = False```

# Type

Sets or returns the type (number) of a portfolio item:

• 0 : Response
• 1 : Grouped Response
• 2 : Calculated Response
• 3 : Interval
```	dim myGroup As ProfileItem
myGroup.Caption = "Total"
myGroup.Type = 1 ```

## ...[return to top of 'ProfileItem' section]

 ProfileQuestion keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 Add 5.5.2 ProfileQuestion (✔) 2 Clear 5.5.2 ProfileQuestion (✔) 3 Question 5.5.2 Question (✔)

...[return to top]

# Add

Adds a profile item to a profile question

## Parameters:

```	Dim myProfile as Profile
Dim myProfileQuestion as ProfileQuestion
myProfileQuestion.Question = Gender
myProfileQuestion.DeleteAll()
Dim myGroup as ProfileItem
myGroup.Caption = "Male + Female"
myGroup.Type = 1
myProfileQuestion.Add(myGroup)

Dim myResponse1 as ProfileItem
myResponse1.Type = 0
myResponse1.Response = 1
myProfileQuestion.Add(myResponse1, myGroup)

Dim myResponse2 as ProfileItem
myResponse2.Type = 0
myResponse2.Response = 2
myProfileQuestion.Add(myResponse2, myGroup, myResponse1)

myProfile.Add(myProfileQuestion)```

# Clear

Deletes all items of a profile question e.g.

```	Dim myProfileQuestion as ProfileQuestion
myProfileQuestion.Question = Gender
myProfileQuestion.Clear()```

# Question

Sets or returns the question for that profile question e.g.

```	Dim myQuestion as ProfileQuestion
myQuestion.Question = Gender```

## ..[return to top of 'ProfileQuestion' section]

 Debug keyword Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 Trace 5.3.5 Debug ✔ ✔ ✔ ✔

...[return to top]

# Trace

Outputs a string to the debug file to understand while your script is not (yet) doing what you want it to do.

## Parameters:

```	 Dim dValue = CurrentCell.Row.Question.Data.FilterByX().Size
Debug.Trace("Column is: " + CurrentCell.X)
Debug.Trace("Row question is: " + CurrentCell.Row.Question.Shortcut)```

 Array keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 Avg 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 2 Count 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 3 IndexOf 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 4 IndexOfMax 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 5 IndexOfMin 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 6 Insert 5.3.2 Array ✔ ✔ ✔ ✔ ✔ 7 InsertAt 5.3.2 Array ✔ ✔ ✔ ✔ ✔ 8 Join 5.3.3 String ✔ ✔ ✔ ✔ ✔ 9 LoadJSON 5.4.8 MethodResult ✔ ✔ ✔ ✔ ✔ 10 Max 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 11 Merge 5.3.2 Array ✔ ✔ ✔ ✔ ✔ 12 Min 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 13 Push 5.3.2 Array ✔ ✔ ✔ ✔ ✔ 14 Remove 5.3.2 Array ✔ ✔ ✔ ✔ ✔ 15 RemoveAt 5.3.2 Array ✔ ✔ ✔ ✔ ✔ 16 RemoveDuplicates 5.4.8 Array ✔ ✔ ✔ ✔ ✔ 17 SelectRandom 5.3.2 Array ✔ ✔ ✔ ✔ ✔ 18 SetAt 5.3.3 Array ✔ ✔ ✔ ✔ ✔ 19 Shuffle 5.3.2 Array ✔ ✔ ✔ ✔ ✔ 20 Sort 5.3.2 Array ✔ ✔ ✔ ✔ ✔ 21 SortDesc 5.3.2 Array ✔ ✔ ✔ ✔ ✔ 22 StdDev 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 23 StdDevEst 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 24 Sum 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 25 ToString 5.3.2 String ✔ ✔ ✔ ✔ ✔

...[return to top]

# Avg

Calculate the average of numerical data. Returns 0 if the array is empty. Only available for an array of numbers e.g.

``` dim arr = {2;4}
arr.Avg() ' => 3

dim emptyArray = {1;2}
emptyArray.Remove({1;2})
emptyArray.Avg() ' => 0```

# Count

Return the number of items in the array e.g

``` dim my_array = {3;4}
my_array.Count ' => 2```

# IndexOf

Search the data in the array and returns its position number (based 1). Returns DK if the data is not found.

## Parameters:

• Value (required) - Value to search (any basic types)
• isCaseSensitive (optional) - Only available for an array of strings. When true indicates if the search must be case sensitive (by default the search is not case sensitive).
``` dim arr= {2;4;5;1;3}
arr.IndexOf(4) ' => 2
arr.IndexOf(10) ' => DK (not found)
'
dim arr2 = {"b";"a";"c"}
arr2.IndexOf("a") ' => 2
'
dim arr3 = {"abc"; "ABC"}
arr3.IndexOf("aBc", true) ' => DK (not found)
arr3.IndexOf("ABC", true) '=> 2```

# IndexOfMax

Use this function to return the index of the nth highest value of data. Returns DK when the 'nth highest value' is out of bounds.

## Parameters:

• nthHighest - Number (Optional) - nth highest index to obtain. (1st by default)
``` dim arr = {10;20;3;1}
arr.IndexOfMax() ' => 2
arr.IndexOfMax(2) ' => 1
arr.IndexOfMax(5) ' => DK (Out of bound)```

# IndexOfMin

Use this function to return the index of the nth lowest value of data. Returns DK when the 'nth lowest value' is out of bounds.

## Parameters:

• nthLowest - Number (Optional) - nth highest index to obtain. (1st by default)
``` dim arr = {10;20;3;1}
arr.IndexOfMin() ' => 4
arr.IndexOfMin(2) ' => 3
arr.IndexOfMin(5) ' => DK (Out of bound)```

Insert

This method modifies the object in place and returns an array. Use it to add a set of values/data allowing repetition (with duplicates) at the end of the array. The usage of the chained calls must be done in a single line (no carriage return). If you want to execute multiple operations in multiple lines, write a complete operation sentence on each line.

## Parameters:

• Value - Any - Value to add
``` dim arr = {2;4}
arr.Insert({1;4}) ' => arr
return arr ' => {2;4;1;4}

dim arr = {"b";"a"}
arr.Insert({"c";"a"}) ' => arr
return arr ' => {"b";"a";"c";"a"}

dim arr = {2;4}
arr.Insert(5) ' => arr
return arr ' => {2;4;5}

Chains calls examples:

' Legal syntaxes in single line:
dim my_array = {1; 2}
my_array.Insert(3) + {4}
' => my_array with values {1; 2; 3; 4}
my_array.Insert(5).Insert(6)
' => my_array with values {1; 2; 3; 4; 5; 6}

' Illegal syntaxes in multiline:
dim my_array = {1; 2}
my_array.Insert(3)
+
{4}  ' => Compilation error

dim my_array = {1;2}
my_array.Insert(5)
.Insert(6) ' => Compilation error

' Legal syntaxes in multiline:
dim my_array = {1; 2}
my_array.Insert(3)
my_array = my_array + {4}
' =>  my_array with values {1;2;3;4}
my_array.Insert(5)
my_array.Insert(6)
' => my_array with values {1;2;3;4;5;6}```

# InsertAt

This method modifies the object in place and returns an array. Use it to add a set of values/data allowing repetition (with duplicates) at the specific index of the array. The usage of the chained calls must be done in a single line (no carriage return). If you want to execute multiple operations in multiple lines, write a complete operation sentence on each line.

## Parameters:

• Value - Any - Value to add
``` dim arr = {2;4}
arr.InsertAt(2, {1; 3}) ' => arr
return arr  ' => {2;1;3;4}

dim arr = {"b";"a"}
arr.InsertAt(1, {"c";"a"}) ' => arr
return arr ' => {"c";"a";"b";"a"}

Chains calls examples:

' Legal syntaxes in single line:
dim my_array = {5; 6}
my_array.InsertAt(1, {3; 4}) + {7}
' => my_array with values {3; 4; 5; 6; 7}
my_array.InsertAt(1, {2}).InsertAt(1, {1})
' => my_array with values {1; 2; 3; 4; 5; 6; 7}

' Illegal syntaxes in multiline:
dim my_array = {1; 2}
my_array.InsertAt(1, {3; 4})
+
{7}  ' => Compilation error

dim my_array.Insert(1, {2})
.Insert(1, {1}) ' => Compilation error

' Legal syntaxes in multiline:
dim my_array = {5; 6}
my_array.InsertAt(1, {3; 4})
my_array = my_array + {7}
' =>  my_array with values {3;4;5;6;7}
my_array.InsertAt(1, {2})
my_array.InsertAt(1, {1})
' => my_array with values {1;2;3;4;5;6;7}```

# Join

Convert an array to string using the specified separator.

## Parameters:

• Separator - String (Optional) Separator string between values of the array (semi-colon by default)
``` dim arr_num = {1;2;3}
arr_num.Join("|") ' => "1|2|3"

dim arr_bool = {true;false;true}
arr_bool.Join("@") ' => "1@0@1"

dim arr_string = {"a";"b";"c"}
arr_string.Join() ' => "a;b;c"

dim arr_date = {#21/03/2009#;#23/07/2010#;#26/12/2011#}
arr_date.Join(" and ")
' => "21/03/2009 and 23/07/2010 and 26/12/2011"```

# LoadJSON

Parses a JSON string and sets the array

## Parameters:

• Name - String (Optional) - JSON string to be parsed
```	Dim items As Array
Dim result = items.LoadJSON("invalid json format")
' result.Success ' => False
' result.ErrorMessage ' => "SyntaxError: Unexpected token i in JSON at position : 0"
' items ' => @[]

Dim items As Array
Dim result = items.LoadJSON("{\"key1\":\"value1\", \"key2\":12}")
' result.Success ' => False
' result.ErrorMessage ' => "Type mismatch: Expected Array matching type"
' items ' => @[]

Dim items as Dictionary
Dim result = items.LoadJSON("[\"abc\", 123, true]")
' result.Success ' => True
' result.ErrorMessage ' => ""
' items ' => @["abc", 123, True]```

# Max

Use this function to return the nth highest value of data (number). Returns DK when the 'nth highest value' is out of bounds.

## Parameters:

• nthHighest - Number (Optional) - nth highest value to obtain. (1st by default)
``` dim arr = {3;4;1}
arr.Max() ' => 4
arr.Max(2) ' => 3
arr.Max(4) ' => DK (Out of bound)```

# Merge

Those methods modify the object in place. Use it to merge the current array with the data, not allowing repetition (without duplicates). Equivalent to:

• CurrentArray = CurrentArray + data
• CurrentArray = CurrentArray Union data

The usage of the calls chains must be done in a single line (no carriage return). If you want to execute multiple operations in multiple lines, write a complete operation sentence on each line.

## Parameters:

• data - Array - Array or number to add
``` dim arr = {2;4}
arr.Merge({4;5;6;}) ' => arr
return arr '=> {2;4;5;6}

dim arr = {"b";"a"}
arr.Merge({"c";"a"}) ' => arr
return arr ' => {"b";"a";"c"}

Chains calls examples:

' Legal syntaxes in single line:
dim my_array = {1; 2}
my_array.Merge({2; 3}) + {4}
' => my_array with values {1; 2; 3; 4}
my_array.Merge(2).Merge(3).Merge(4)
' => my_array with values {1; 2; 3; 4}

' Illegal syntaxes in multiline:
dim my_array = {1; 2}
my_array.Merge(3)
+
{4}  ' => Compilation error
dim my_array = {1;2}
my_array.Merge(5)
.Merge(6) ' => Compilation error

' Legal syntaxes in multiline:
dim my_array = {1; 2}
my_array.Merge(3)
my_array = my_array + {4}
' =>  my_array with values {1;2;3;4}
my_array.Merge(5)
my_array.Merge(6)
' => my_array with values {1;2;3;4;5;6}```

# Min

Use this function to return the nth smallest value of data (number). Returns DK when the 'nth lowest value' is out of bounds.

## Parameters:

• nthLowest - Number (Optional) - nth lowest value to obtain. (1st by default)
``` dim arr = {3;4;1}
arr.Min() ' => 1
arr.Min(2) ' => 3
arr.Min(4) ' => DK (Out of bound)```

# Push

This method modifies the object in place and returns an array. Use it to add a set of values/data allowing repetition (with duplicates) at the end of the array. This is a synonym of Insert. The usage of the calls chains must be done in a single line (no carriage return). If you want to execute multiple operations in multiple lines, write a complete operation sentence on each line.

## Parameters:

• Value - Any - Value to add
``` dim arr = {2;4}
arr.Push({1;4}) ' => arr
return arr ' => {2;4;1;4}

dim arr = {"b";"a"}
arr.Push({"c";"a"}) ' => arr
return arr ' => {"b";"a";"c";"a"}

dim arr = {2;4}
arr.Push(5) ' => arr
return arr ' => {2;4;5}

Chains calls examples:

' Legal syntaxes in single line:
dim my_array = {1; 2}
my_array.Push(3) + {4}
' => my_array with values {1; 2; 3; 4}
my_array.Push(5).Insert(6)
' => my_array with values {1; 2; 3; 4; 5; 6}

' Illegal syntaxes in multiline:
dim my_array = {1; 2}
my_array.Push(3)
+
{4}  ' => Compilation error

dim my_array = {1;2}
my_array.Push(5)
.Insert(6) ' => Compilation error

' Legal syntaxes in multiline:
dim my_array = {1; 2}
my_array.Push(3)
my_array = my_array + {4}
' =>  my_array with values {1;2;3;4}
my_array.Push(5)
my_array.Push(6)
' => my_array with values {1;2;3;4;5;6}```

# Remove

This method modifies the object in place and returns an array. It removes all elements which match the data. The usage of the calls chains must be done in a single line (no carriage return). If you want to execute multiple operations in multiple lines, write a complete operation sentence on each line

## Parameters:

• Value - Any - Value to remove
``` dim arr = {2;4;5;4;6}
arr.Remove(4) ' => arr ' ({2;5;6})
arr.Remove({2; 6}) ' => arr
return arr ' => {5}

dim arr = {"b";"a";"c";"b"}
arr.Remove("b") ' => arr
return arr ' => {"a";"c"}```

# RemoveAt

This method modifies the object in place and returns an array. It removes the element at the specific index. The usage of the calls chains must be done in a single line (no carriage return). If you want to execute multiple operations in multiple lines, write a complete operation sentence on each line

## Parameters:

• Index - Number - Index of data to remove (based 1)
``` dim arr = {2;4;5;4;6}
arr.RemoveAt(2) ' => arr
return arr ' => {2;5;4;6}```

# RemoveDuplicates

This method modifies the object in place and returns an array. Use it to remove the duplicate values of the array e.g.

```	dim arr = {2;4;5;2;3;4}
arr.RemoveDuplicates() " => arr
return arr "```

# SelectRandom

Use this function to randomly select a specified number of values from an existing array. It returns an array e.g.

``` dim arr = {2;4;5;1;3}
arr.SelectRandom() ' => {4}
arr.SelectRandom(2) ' => {2;5}
'
arr = {"b";"a";"c"}
arr.SelectRandom(2) ' => {"b";"c"}
'
dim emptyArray = {}
emptyArray.SelectRandom() ' => {}```

# SetAt

Set the data at the specific index. This method modifies the object in place and returns an array.
If the specified index is out of range (greater than the size of the array) the data will then be inserted at the end of the array. It will overwrite the data in the position (specified in the 1st parameter) with the new data (specified in the 2nd parameter).

## Parameters:

• Index - Number - Position of the array where the data should be set (base 1)
• Data - Any - Data to set at the specified index
``` dim arr = {2;4}
arr.SetAt(2, 3) ' => arr
return arr  ' => {2;3}

dim arr = {"b";"a"}
arr.SetAt(1, "z") ' => arr
return arr ' => {"z";"a"}

dim arr = {1; 2}
arr.SetAt(4, 5) ' => arr
return arr ' => {1;2;5}

dim arr = {2;4;5}
arr.SetAt(2, {3;4} ) ' => arr
return arr  ' => {2;3;4}```

# Shuffle

This method modifies the object in place and returns an array. Use this function to sort a list of data from an array into a random order.

## Parameters:

• Seed - Number (Optional) - use this number to reapply the same order for another Shuffle in the same interview scope
``` dim arr = {1;2;3;4;5}
arr.Shuffle( ) ' => arr
return arr ' => {2;4;5;1;3}

dim arr1 = {1;2;3;4;5}
arr1.Shuffle( 17 ) ' => arr1 ({3;1;2;5;4})
'
dim arr2 = {11;22;33;44;55}
arr2.Shuffle( 17 ) ' => arr2 ({33;11;22;55;44})```

# Sort

This method modifies the object in place and returns an array. Use this function to sort a list of data from an array into a ascending order e.g.

``` dim arr = {2;4;5;1;3}
arr.Sort() ' => arr
return arr '=> {1;2;3;4;5}```

# SortDesc

This method modifies the object in place and returns an array. Use this function to sort a list of data from an array into a descending order e.g.

``` dim arr = {2;4;5;1;3}
arr.SortDesc() ' => arr
return arr '=> {5;4;3;2;1}```

# StdDev

Only available for an array of numbers. This is askiascript's abbreviation for standard deviation. Use this function to calculated the numerical standard deviation of numerical data where the variance is obtained by dividing by N. To obtain the standard deviation estimator (variance dvided by N-1), use StdDevEst. Returns 0 when the array is empty e.g.

``` dim arr = {10;20;50;75;88}
arr.StdDev() ' => 30.19668856017163

dim emptyArray = {1;2}
emptyArray.Remove({1;2})
emptyArray.StdDev() ' => 0```

# StdDevEst

Only available for an array of numbers. This is askiascript's abbreviation for standard deviation estimator. Use this function to calculated the numerical standard deviation of numerical data where the variance is obtained by dividing by N-1. To obtain the normal standard deviation, use StdDev. Returns 0 when the array is empty e.g.

``` dim arr = {10;20;50;75;88}
arr.StdDevEst() ' => 33.76092415796701

dim emptyArray = {1;2}
emptyArray.Remove({1;2})
emptyArray.StdDevEst() ' => 0```

# Sum

Only available for an array of numbers. Use this function to calculate the numerical sum of numerical data. Returns 0 when the array is empty e.g.

``` dim arr = {2;4}
arr.Sum() ' => 6

dim emptyArray = {1;2}
emptyArray.Remove({1;2})
emptyArray.Sum() ' => 0```

# ToString

Convert an array to string e.g.

``` dim arr_num = {1;2;3}
arr_num.ToString() ' => "1;2;3"
'
dim arr_bool = {true;false;true}
arr_bool.ToString() ' => "1;0;1"
'
dim arr_string = {"a";"b";"c"}
arr_string.ToString() ' => "a;b;c"
'
dim arr_date = {#21/03/2009#;#23/07/2010#;#26/12/2011#}
arr_date.ToString() ' => "21/03/2009;23/07/2010;26/12/2011"```

## ...[return to top of 'Array' section]

 Date keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 Day 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 2 DayOfWeek 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 3 DayOfYear 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 4 Format 5.3.2 String ✔ ✔ ✔ ✔ ✔ 5 Hour 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 6 Minute 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 7 Month 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 8 Second 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 9 ToIsoString 5.4.9 String ✔ ✔ ✔ ✔ ✔ 10 ToNumber 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 11 ToString 5.3.2 String ✔ ✔ ✔ ✔ ✔ 12 ToVariant 5.4.8 Variant ✔ ✔ ✔ ✔ ✔ 13 Year 5.3.2 Number ✔ ✔ ✔ ✔ ✔

...[return to top]

# Day

Returns the day of the date as number.

``` dim dt = #25/03/2011#
dt.Day ' => 25```

# DayOfWeek

Returns the day of the week (1-7) of the specified date.

• if the day is Sunday, the property will return 1.
• if the day is Monday, the property will return 2.
• if the day is Saturday, the property will return 7, and so on.
``` dim dt = #25/03/2011#
dt.DayOfWeek ' => 6```

# DayOfYear

Returns the day of the year (1-366) of the specified date.

• if the date is 01/01/2012, the property will return 1.
• if the date is 31/12/2012, the property will return 365, and so on.
``` dim dt = #15/11/2019#
dt.DayOfYear ' => 319```

# Format

Format a date to string using the format parameter

## Parameters:

• Format - String - of the date to obtain (case sensitive)
• string2 - String (Optional)
• string3 - String (Optional)
``` dim dt= #02/03/2011 16:32:07# ' March 2nd, 2011
dt.Format("dd/MM/yyyy") ' => "02/03/2011"
dt.Format("yyyy-MM-dd") ' => "2011-03-02"
dt.Format("MM/dd/yyyy") ' => "03/02/2011"
dt.Format("dd MMM yyyy") ' => "02 Mar 2011"
dt.Format("dd MMMM yyyy") ' => "02 March 2011"
dt.Format("MMMM dd, ddd.  yyyy") ' => "March 02, Wed. 2011"
dt.Format("MMMM dd, dddd yyyy") ' => "March 02, Wednesday 2011"
dt.Format("d-M-yy") ' => "2-3-11"
dt.Format("dd/MM/yyyy HH:mm") ' => "02/03/2011 16:32"
dt.Format("dd/MM/yyyy hh:mm") ' => "02/03/2011 04:32"
dt.Format("dd/MM/yyyy hh:mmampm") ' => "02/03/2011 04:32pm"
dt.Format("dd/MM/yyyy hh:mm:ssAMPM") ' => "02/03/2011 04:32:07PM"```

# Hour

Returns the hour of the time as number e.g.

``` dim tm = #16:32:07#
tm.Hour ' => 16```

# Minute

Returns the minute of the time as number e.g.

``` dim tm = #16:32:07#
tm.Minute ' => 32```

# Month

Returns the month of the date as number e.g.

``` dim dt = #25/03/2011#
dt.Month ' => 3```

# Second

Returns the second of the time as number e.g.

``` dim tm = #16:32:07#
tm.Second ' => 7```

# ToIsoString

Converts a date to its ISO string representation, according to ISO 8601 e.g.

```	dim dt = #25 / 03 / 2011 16:32 : 07#
dt.ToIsoString() ' => "2011-03-25T16:32:07.000Z"```

# ToNumber

Try to convert the date to a number.

``` dim dt= #25/03/2011 16:32:07#
dt.ToNumber() ' => 40627.688969907409```

# ToString

Convert a date to a string using the regional settings context (from the language of respondent or the current machine). Prefer use of "Format" methods if you want to enforce/fix the format e.g.

``` dim dt= #25/03/2011 16:32:07#
dt.ToString() ' => "25/03/2011 16:32:07" or "3/25/2011 04:32:07 PM"
' depending on the regional settings```

# ToVariant

Converts a date into a variant. Return a array of numbers.

`#6/11/2001#.ToVariant()`

# Year

Returns the year of the date as number e.g.

``` dim dt = #25/03/2011#
dt.Year ' => 2011```

## ...[return to top of 'Date' section]

 Number keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 Abs 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 2 Ceil 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 3 Floor 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 4 Format 5.3.2 String ✔ ✔ ✔ ✔ ✔ 5 Log 5.3.5 Number ✔ ✔ ✔ ✔ ✔ 6 Log10 5.3.5 Number ✔ ✔ ✔ ✔ ✔ 7 Pow 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 8 Round 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 9 ToBoolean 5.4.8 Boolean ✔ ✔ ✔ ✔ ✔ 10 ToDays 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 11 ToHours 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 12 ToInt 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 13 ToMinutes 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 14 ToSeconds 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 15 ToString 5.3.2 String ✔ ✔ ✔ ✔ ✔ 16 ToVariant 5.4.8 Variant ✔ ✔ ✔ ✔ ✔

...[return to top]

# Abs

Returns the absolute part of a number. (Positive value) e.g.

``` dim counter = -3
counter.Abs() ' => 3
'
dim i = -1.5
i.Abs() ' => 1.5```

# Ceil

Returns the next highest number by rounding up value.

## Parameters:

• decimals - Number (Optional) - Number of decimal to keep. If not specified, no decimal will be get (same as 0)
``` dim counter = 1.2
counter.Ceil() ' => 2
'
dim i = -3.14
i.Ceil() ' => -3
'
dim j = 1.5222
j.Ceil(2) ' => 1.53```

# Floor

Returns the next lowest number by rounding down value.

## Parameters:

• decimals - Number (Optional) - Number of decimal to keep. If not specified, no decimal will be get (same as 0)
``` dim counter = 1.7
counter.Floor() ' => 1
'
dim i = -3.84
i.Floor() ' => -4
'
dim j = 1.5777
j.Floor(2) ' => 1.57```

# Format

Format a number to string using the format parameter. When the separators are omitted, the system will use the separators from the regional settings context. (Language of the respondent or the regional settings of the current machine)

## Parameters:

• format - String - Representation of the desire format
• decimalSep - String (Optional) - Decimal separator
• thousandSep - String (Optional) - Thousand separator
``` dim i = 3456.7
i.Format("00000.00")
' => "03456.70" or "03456,70"
' depending on the regional settings
'
i.Format("#.##")
' =>"3456.7" or "3456,7"
' depending on the regional settings
'
i.Format("#,##0.00")
'=>  "3,456.70" or "3 456,70" or "3.456,70"
'  depending on the regional settings
'
i.Format("\$#,##0.00")
'=> "\$3,456.70" or "\$3 456,70" or "\$3.456,70"
' depending on the regional settings
'
'
i = 0.1
i.Format("#.##") ' => ".1" or ",1"
' depending on the regional settings
'
i.Format("0.##") ' => "0.1" or "0,1"
' depending on the regional settings
'
i.Format("0.00") ' => "0.10" or "0,10"
' depending on the regional settings
'
'
i = 123456.78
i.Format("#,##0.00", ",", ".") ' => "123.456,78"
i.Format("#,##0.00", ".", ",") ' => "123,456.78"
i.Format("#,##0.00", "#", "@") ' => "123@456#78"
i.Format("#.##", ",") ' => "123456,78"
i.Format("#.##", ".") ' => "123456.78"```

# Log

Returns the Napierian logarithm of the number e.g.

``` dim counter = 1
counter.Log() ' => 0 dim counter = 2.71828 counter.Log() ' => 0.999999327347282```

# Log10

Return the base 10 logarithm of the number e.g.

``` dim counter = 1
counter.Log10() ' => 0
counter = 100
counter.Log10() ' => 2
```

# Pow

Returns the power of a value

## Parameters:

• Power - Number - Power value
``` dim counter = 2
counter.Pow(3) ' => 8
'Same as (2 * 2 * 2)```

# Round

Rounds a number.

## Parameters:

• Decimal - Number (Optional) - Number of decimal to keep. If not specified, no decimal will be kept (same as 0)
``` dim counter = 1.2
counter.Round() ' => 1
'
dim i = 1.5
i.Round() ' => 2
'
dim j = 1.55555
j.Round(2) ' => 1.56
'
dim k = 1
k.Round(2) ' => 1```

# ToBoolean

Converts whatever value to a boolean e.g.

```	Dim i = 0
return i.ToBoolean() ' => false```

# ToDays

Converts the specified number of days to days e.g.

``` dim i = 2
i.ToDays() ' => 2
(Date1 - Date2).ToDays() ' => The number of days```

# ToHours

Converts the specified number of days to hours: ( number * (24) ) e.g.

``` dim i = 2
i.ToHours() ' => 48
(Date1 - Date2).ToHours()
' => (Date1 - Date2) * (24)```

# ToInt

Converts a number (double) to integer. This method will not round up the number i.e. it will take the integer shown before the decimal point e.g.

``` dim counter = 1.2
counter.ToInt() ' => 1
'
dim i = 1.5
i.ToInt() ' => 1```

# ToMinutes

Converts the specified number of days to minutes: ( number * (24 * 60) ) e.g.

``` dim i = 2
i.ToMinutes() ' => 2880
(Date1 - Date2).ToMinutes()
' => (Date1 - Date2) * (24 * 60)```

# ToSeconds

Converts the specified number of days to seconds: ( number * (24 * 3600) ) e.g.

``` dim i = 2
i.ToSeconds() ' => 172800
(Date1 - Date2).ToSeconds()
' => (Date1 - Date2) * (24 * 3600)```

# ToString

Converts a number to string using the regional settings context (from the language of respondent or the current machine) to determine the decimal separator. Prefer use of "Format" methods if you want to enforce/fix the decimal separator:

``` dim counter = 1.9
counter.ToString() ' => "1.9" or "1,9"
' depending on the regional settings```

# ToVariant

Converts a number into a variant. Returns a variant

`	3.ToVariant()`

## ...[return to top of 'Number' section]

 String keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 Collate 5.4.5 Number ✔ ✔ ✔ ✔ ✔ 2 CollateAny 5.4.6 Array ✔ ✔ ✔ ✔ ✔ 3 DLdistance 5.4.5 Number ✔ ✔ ✔ ✔ ✔ 4 IndexOf 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 5 IsDate 5.3.2 Boolean ✔ ✔ ✔ ✔ ✔ 6 IsEmail 5.3.2 Boolean ✔ ✔ ✔ ✔ ✔ 7 IsMatch 5.3.2 Boolean ✔ ✔ ✔ ✔ ✔ 8 IsNumber 5.3.2 Boolean ✔ ✔ ✔ ✔ ✔ 9 IsUKPostcode 5.3.2 Boolean ✔ ✔ ✔ ✔ ✔ 10 Left 5.3.2 String ✔ ✔ ✔ ✔ ✔ 11 Length 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 12 Replace 5.3.2 String ✔ ✔ ✔ ✔ ✔ 13 ReplaceRegexp 5.5.2 String ✔ ✔ ✔ ✔ ✔ 14 Right 5.3.2 String ✔ ✔ ✔ ✔ ✔ 15 Split 5.3.2 Array ✔ ✔ ✔ ✔ ✔ 16 SplitToNumbers 5.3.3 Array ✔ ✔ ✔ ✔ ✔ 17 SubString 5.3.2 String ✔ ✔ ✔ ✔ ✔ 18 ToAscii 5.3.5 String ✔ ✔ ✔ ✔ ✔ 19 ToDate 5.3.2 Date ✔ ✔ ✔ ✔ ✔ 20 ToHexa 5.3.3 String ✔ ✔ ✔ ✔ ✔ 21 ToLowerCase 5.3.2 String ✔ ✔ ✔ ✔ ✔ 22 ToNumber 5.3.2 Number ✔ ✔ ✔ ✔ ✔ 23 ToRGB 5.3.3 String ✔ ✔ ✔ ✔ ✔ 24 ToRGBA 5.3.3 String ✔ ✔ ✔ ✔ ✔ 25 ToString 5.3.2 String ✔ ✔ ✔ ✔ ✔ 26 ToUpperCase 5.3.2 String ✔ ✔ ✔ ✔ ✔ 27 ToVariant 5.4.8 Variant ✔ ✔ ✔ ✔ ✔ 28 Trim 5.3.2 String ✔ ✔ ✔ ✔ ✔

...[return to top]

# Collate

Compares two strings using the locale language...

• Primary -- ignore accents and character case, comparing base letters only. For example "facade" and "Façade" are the same.
• Secondary -- ignore character case but consider accents. "facade" and "façade" are different but "Façade" and "façade" are the same.
• Tertiary -- consider both case and accents: "Façade" and "façade" are different. Ignore punctuation.
• Quaternary -- consider all case, accents, and punctuation. The words must be identical in terms of Unicode representation.
• Identical -- as quaternary, but compare code points as well.

## Parameters:

• String - String - to be compared with
• Comparison - Number (Optional) - Type of comparison (primary, secondary, tertiary, quartenary or identical - primary by default)
• Language - Variant - (the abbreviation or the ID)

The function returns:

• a negative number if the object is before the parameter alphabetically...
• a positive number if the object is after the parameter alphabetically
• 0 if they are thought to be the same
```	dim s = "abcde"
s.Collate("fghi") ' => negative

dim s = "gfhi"
s.Collate("abcde") ' =>  positive

dim s = "abcde"
s.Collate("abcde") ' => 0

dim s = "Fussballmanager"
s.Collate("fußballmanager",1,"DEU") ' => 0

dim s = "Fussballmanager"
s.Collate("fußballmanager",2,1031) ' => 1```

# CollateAny

Compares a string (object) with an array of strings using the locale language and returns the index of the strings that match.

• Primary -- ignore accents and character case, comparing base letters only. For example "facade" and "Façade" are the same.
• Secondary -- ignore character case but consider accents. "facade" and "façade" are different but "Façade" and "façade" are the same.
• Tertiary -- consider both case and accents: "Façade" and "façade" are different. Ignore punctuation.
• Quaternary -- consider all case, accents, and punctuation. The words must be identical in terms of Unicode representation.
• Identical -- as quaternary, but compare code points as well.

## Parameters:

• String - String - to be compared with
• Comparison - Number (Optional) - Type of comparison (primary, secondary, tertiary, quartenary or identical - primary by default)
• Language - Variant - (the abbreviation or the ID)

The function returns an array of numbers to indicate which strings have been matched

```	dim s = "abcde"
s.CollateAny({"ab"; "abcded"; "fghi"}) ' => returns {2}

dim s = "Fussballmanager"
s.CollateAny({"footbal" ; "fussballmanager"; "fußballmanager"},1,"DEU") ' => returns {2;3}```

# DLdistance

Calculate edit distance (number) between two strings using the Damerau-Levenshtein Distance. This distance is very useful to find spelling errors.

## Parameters:

• String - String - to compare
```	dim s = "abcde"
s.DLDistance("abce") ' => 1

dim s = "abcde"
s.DLDistance("abdce") ' => 1

dim s = "abcde"
s.DLDistance("abcde") ' => 0```

# IndexOf

Search the text in the string and returns its position (based 1). Returns DK if the text is not found. By default, the text search is not case sensitive.

## Parameters:

• Text - String - String to search
• CaseSensitive - Number (Optional) - When true indicates if the search must be case sensitive
``` dim s = "abcdefghijk"
s.IndexOf("cde") ' => 3
s.IndexOf("BcD") ' => 2
s.IndexOf("lmn") ' => DK (not found)
'
s.IndexOf("CDE", true) ' => DK (not found with the case sensitive flag)```

# IsDate

Verify the format of the string as a valid date format using the regional settings associated with the current interview or using the optional format parameter you can enforce a specific format.

## Parameters:

• Format - String (Optional) - Indicates the date format to use for the validation
``` dim s = "22/03/2011"
s.IsDate() ' => True
'
s = "22##03##2011"
s.IsDate() ' => False
s.IsDate("dd##MM##yyyy") ' => True```

# IsEmail

Verify the format of the string as a valid email format (x@x.xxx) e.g.

``` dim s = "askia@askia.com"
s.IsEmail() ' => True
'
dim s1 = "askia#askia.com"
s1.IsEmail() ' => False```

# IsMatch

Verify the format of the string as a valid format using regular expression

## Parameters:

• regexp - String - Regular expression as string
``` dim email = "askia@askia.com"
email.IsMatch("w+@w+.[a-z]+")
'
' Regular expression to valid
' that a string contains the uk phone number pattern
' +(##) ### ### #### or 00## ### ### ####
dim rgUkPhone = "(+|00)s*d{2}(s?d{3}){2}s?d{4}"
'
("0044 207 689 5492").IsMatch(rgUkPhone) ' => true
("00442076895492").IsMatch(rgUkPhone) ' => true
("+44 207 689 5492").IsMatch(rgUkPhone) ' => true
("+442076895492").IsMatch(rgUkPhone) ' => true
("207 689 5492").IsMatch(rgUkPhone) ' => false
("44 207 689 5492").IsMatch(rgUkPhone) ' => false
("442076895492").IsMatch(rgUkPhone) ' => false
("Before it was 00 44 204 689 5492 and now it's 00 44 207 689 5492").IsMatch(rgUkPhone)
' => true
("My contact numbers are:
+44 207 689 5492
or
0044 207 123 4567").IsMatch(rgUkPhone) ' => true
'
' Same regular expression than above
' but test if the string ONLY contains
' the uk phone number and nothing else
dim rgOnlyUkPhone = "^(+|00)s*d{2}(s?d{3}){2}s?d{4}\$"
'
("+44 207 689 5492").IsMatch(rgOnlyUkPhone) ' => true
("0044 207 689 5492").IsMatch(rgOnlyUkPhone) ' => true
("Before it was 00 44 204 689 5492
and now it's 00 44 207 689 5492").IsMatch(rgOnlyUkPhone)
' => false```

# IsNumber

Verify the format of the string as a valid number format e.g.

``` dim s = "abcde"
s.IsNumber() ' => 0
Dim s = "123.99"
s.IsNumber() ' => True
Dim s = "123,99"
s.IsNumber() ' => True
Dim s = "123,999.32"
s.IsNumber() ' => False thousand separators not supported```

# IsUKPostcode

Verify the format of the string as a valid UK Postcode format e.g.

``` dim s = "L1 4AB"
s.IsUKPostCode() ' => True
'
s = "L4B1C12"
s.IsUKPostCode() ' => False```

# Left

Extract a left part of the string. If the specified length is higher than the length of the string, it returns the entire string.

## Parameters:

• length - Number - Positive number which indicates the length of the sub-string to extract
``` dim s = "abcde"
s.Left(3) ' => "abc"
s.Left(10) ' => "abcde"```

# Length

Returns the length of the string (number of characters) e.g.

``` dim my_string = "abcd"
my_string.length  ' => 4
dim my_empty_string = ""
my_empty_string.length ' => 0```

# Replace

Returns a new string and replace the specify pattern by the specify replacement (by default the text replacement is not case sensitive).

## Parameters:

• pattern - String - String to replace
• replacement - String - Replacement string
• caseSensitive - Boolean (Optional) - When true indicates if the replacement must be case sensitive
``` dim s = "Hello world!"
s = s.Replace("Hello", "Hi")
' => "Hi world!"
'
dim abc = "abc"
abc = abc.Replace("A", "X")
' => "Xbc"
'
dim case = "Sensitive"
case.Replace("sensitive", "Insensitive", true)
' => "Sensitive" Doesn't change
'
case.Replace("sensitive", "Insensitive",false)
' => "Insensitive"```

# ReplaceRegexp

Returns a new string and replaces the first match of the specified regexp pattern by the specified replacement. By default the text replacement is case sensitive.

• If there is 'i' (insensitive) modifier in the third parameter the text replacement is not case sensitive.
• If there is 'g' (global) modifier in the third parameter the replacement is done on all matches.

## Parameters:

• regexp - String - Pattern to replace
• replacement - String - Replacement string
• modifier - String (Optional) - Modifier of the regexp
```
dim case = "Sensitive"
case.Replace("s.*n", "Insen")
' => "Sensitive" Doesn't change
'
dim s = "Sensitive"
s = s.ReplaceRegexp("s.*n", "Insen", "i")
' => "Insensitive"
'
dim case = "abcdef"
case.ReplaceRegexp("[a-e]", "X")
' => "Xbcdef" The replacement is done only on the first match
'
dim case = "abcdef"
case.ReplaceRegexp("[a-e]", "X", "g")
' => "XXXXXf" The replacement is done on all matches
'
dim case = "abcdef"
case.ReplaceRegexp("[A-E]", "X", "g")
' => "abcdef" Doesn't change
'
dim case = "abcdef"
case.ReplaceRegexp("[A-E]", "X", "gi")
' => "XXXXXf"
```

# Right

Extract a right part of the string. If the specified length is higher than the length of the string, it returns the entire the string.

## Parameters:

• Length - Number - Positive number which indicates the length of the sub-string to extract
``` dim s = "abcde"
s.Right(3) ' => "cde"
s.Right(10) ' => "abcde"```

# Split

Split a given string into an array of strings.

## Parameters:

• Separator - String (Optional) - Separator string (coma by default)
``` dim s = "1,3,5,7,9"
s.Split()
' => {"1"; "3"; "5"; "7"; "9"}
'
s = "a|b|c|d|e"
s.Split("|")
' => {"a"; "b"; "c"; "d"; "e"}
'
s = "a|b|c|d|e"
s.Split("|")[2]
' => "b"```

# SplitToNumbers

Split a given string into an array of numbers.

## Parameters:

• Separator - String (Optional) - Separator string (coma by default)
``` dim s = "1,3,5,7,9"
s.SplitToNumbers()
' => {1; 3; 5; 7; 9}
'
s = "1|3|5|7|9"
s.SplitToNumbers("|")
' => {1; 3; 5; 7; 9}
'
s = "1|3|5|7|9"
s.SplitToNumbers("|")[2]
' => 3
'
s = "1|3|toto|7|tata|12"
s.SplitToNumbers("|")
' => {1; 3; DK; 7; DK; 12}```

# SubString

Extract a sub-string starting at the specified index (based 1) with a given length. If the specified length is higher than the length of the string, it returns the end of the string. If the start position is higher than the length of the string, it returns an empty string.

## Parameters:

• Start - Number - Positive number which indicates the start of the sub-string
• Length - Number (Optional) - Positive number which indicates the length of the sub-string to obtain. If it is not set, it returns the rest of the string
``` dim s = "abcde"
s.Substring(2, 3) ' => "bcd"
s.Substring(2) ' => "bcde"
s.Substring(3, 10) ' => "cde"
s.Substring(10, 2) ' => ""```

# ToAscii

Use this function to convert a unicode string string into ASCII string e.g.

``` dim s = ""ＭＴＶ""
s.ToAscii() ' => "MTV"```

# ToDate

Use this function to convert the string as a date using the regional settings associated with the current interview or using the optional format parameter you can enforce a specific format. Returns DK when the string could not be converted to a date.

## Parameters:

• Format - String (Optional) - Indicates the date format of the string
``` dim s = "22/03/2011"
s.ToDate() ' => #22/03/2011#
'
dim t = "2011-03-22"
t.ToDate("yyyy-MM-dd") ' => #22/03/2011#
'
dim invalidDate = "Hello world!"
invalidDate.ToDate() ' => DK (Invalid date)```

# ToHexa

Try to convert the string which represent a color (hexa, rgb or rgba) to it's Hexadecimal equivalent string.
Drop the "alpha" value when the string represent an RGBA color.
Returns an empty string when fail to convert. Trailing white-spaces will be striped before the conversion.

``` dim hexa_red_color = "#ff0000"
hexa_red_color.ToHexa() '=> "#ff0000"

dim rgba_green_color = "0,255,0,0.5"
rgba_green_color.ToHexa() '=> "#00ff00"

dim rgb_blue_color = "0,0,255"
rgb_blue_color.ToHexa() '=> "#0000ff"

dim not_a_color = "not a color"
not_a_color.ToHexa() '=> ""

dim named_color = "red"
named_color.ToHexa() '=> "" (not interpreted)```

# ToLowerCase

Returns a new string in lowercase e.g.

``` dim s = "Hello World!"
s = s.ToLowerCase()
' => "hello world!"```

# ToNumber

Tries to convert the string to a number. Returns DK when the string could not be converted to number. Be careful, the thousand separator could make an exception during the conversion. Some countries use the coma as a decimal separator whereas others use it for the thousand separator:

e.g. "123,456" is a 123.456 for French but 123456 for American.

To avoid confusion the thousand separator is not allowed in the conversion.

``` dim s = "abcde"
s.ToNumber() ' => DK (not a valid number)
'
s = "123"
s.ToNumber() ' => 123
'
s = "123.99"
s.ToNumber() ' => 123.99
'
s = "123,456"
s.ToNumber() ' => 123.456
'
s = "123,456.789"
s.ToNumber() ' => DK (not a valid number)
' The thousand separator generate an exception```

# ToRGB

Tries to convert the string which represents a colour (hexa, rgb or rgba) to its RGB equivalent string.
Drop the "alpha" value when the string represents an RGBA colour. Returns an empty string when it fails to convert. Trailing white-spaces will be stripped before the conversion.

``` dim hexa_red_color = "#ff0000"
hexa_red_color.ToRGB() '=> "255,0,0"

dim rgba_green_color = "0,255,0,0.5"
rgba_green_color.ToRGB() '=> "0,255,0"

dim rgb_blue_color = "0,0,255"
rgb_blue_color.ToRGB() '=> "0,0,255"

dim not_a_color = "not a color"
not_a_color.ToRGB() '=> ""

dim named_color = "red"
named_color.ToRGB() '=> "" (not interpreted)```

# ToRGBA

Tries to convert the string which represents a colour (hexa, rgb or rgba) to its RGB equivalent string.
Drop the "alpha" value when the string represents an RGBA color. Returns an empty string when it fails to convert. Trailing white-spaces will be stripped before the conversion.
Always make the colour fully opaque when the opacity is not part of the colour representation.
Returns an empty string when it fails to convert.
Trailing white-spaces will be striped before the conversion.

``` dim hexa_red_color = "#ff0000"
hexa_red_color.ToRGBA() '=> "255,0,0,1"

dim rgba_green_color = "0,255,0,0.5"
rgba_green_color.ToRGBA() '=> "0,255,0,0.5"

dim rgb_blue_color = "0,0,255"
rgb_blue_color.ToRGBA() '=> "0,0,255,1"

dim not_a_color = "not a color"
not_a_color.ToRGBA() '=> ""

dim named_color = "red"
named_color.ToRGBA() '=> "" (not interpreted)```

# ToString

Returns the string representation of the object / variable e.g.

``` dim s = "Hello world!"
s.ToString() ' => "Hello world!"```

# ToUpperCase

Returns a new string in uppercase e.g.

``` dim s = "Hello world!"
s = s.ToUpperCase()
' => "HELLO WORLD!"```

# ToVariant

Converts a string into a variant.

` "Abc".ToVariant()`

# Trim

Returns a new string without the trailing spaces before and after the string.

``` dim s = "  spaces before/after   "
s = s.Trim()
' => "spaces before/after"```

## ...[return to top of 'String' section]

 Global keywords Since Type Returned Automation Scripts Cleaning Scripts Calculation Arithmetic Calc var / Aggregated Scripts Script calculations 1 As 5.4.5 ✔ ✔ ✔ ✔ 2 Calc 5.3.2 Number (✔) 3 CalcStr 5.4.6 String (✔) 4 ColQuestion 5.3.5 Question (✔) 5 ColSubQuestion 5.3.5 Question (✔) 6 CurrentCell 5.3.5 Cell (✔) 7 CurrentTable 5.3.5 Table ✔ ✔ 8 EndFunction 5.4.5 ✔ ✔ ✔ ✔ ✔ 9 EndModule 5.4.5 ✔ ✔ ✔ ✔ ✔ 10 Function 5.4.5 ✔ ✔ ✔ ✔ ✔ 11 GetTable 5.3.5 Table ✔ ✔ 12 Module 5.4.5 ✔ ✔ ✔ ✔ ✔ 13 RowQuestion 5.3.5 Question (✔) 14 RowSubQuestion 5.3.5 Question (✔) 15 FindIndexIn 5.3.2 Number ✔ ✔ ✔ ✔ ✔

...[return to top]

# As

Allows to define the type of a parameter or the return type of a function e.g.

```	Function Increment( i As Number) As Number
return i + 1
EndFunction```

# Calc

This allows to access easily all other calculations related to this cell - note that you cannot refer to another arithmetic calculation placed after as the calculation has not been made when you are evaluating this

## Parameters:

• Indices - Number - the index of the calculation
```	Calc(1) / 100 * 55000000 ' bring the percentage to 55 000 000
```

# CalcStr

This allows to access easily all other calculations related to this cell - note that you cannot refer to another arithmetic calculation placed after as the calculation has not been made when you are evaluating this

The return value is a string

## Parameters:

• Indices - Number - the index of the calculation
`	If Calc(1) > 20 Then ' 1st calculation is counts, if the counts are greater than 20         Return CalcStr(3)    ' 3rd calculation is ColSig, return the string of ColSig letters        Else         Return ""           ' Otherwise return a empty string        Endif`

# ColQuestion

Return the question placed in the column e.g.

`ColQuestion.Shortcut ' => "gender" if the question in the column`

# ColSubQuestion

Return the first child question of the question placed in the column. This is extremely useful if you want to have a template that automatically picks on which questions are used and creates a increment weighting for instance.

`ColSubQuestion.Shortcut ' => "Rating" if the question in the column is a loop called Brands who has one sub-question called Rating`

# CurrentCell

Method called to obtain information about the current cell when using calculation arithmetics e.g.

``` CurrentCell.X ' => position of the cell in the table
CurrentCell.Text ' => "Title"```

# CurrentTable

Method called to obtain information about the current table when using calculation arithmetics e.g.

``` CurrentTable.MaxX ' => 20
CurrentTable.GetCell(1,1).Text ' => "Title"```

# EndFunction

Part of the Function / EndFunction statement. Indicates the end of the a function e.g.

```	Function Increment( i As Number) As Number
return i + 1
EndFunction```

# EndModule

Signals the end of a module e.g.

```	Module AdvancedMath
Export Dim Pi = 3.14159
End Module```

# Function

Signals the start of a function e.g.

```	Function Increment( i As Number) As Number
return i + 1
EndFunction```

# GetTable

This allows to access a table which is placed in the same portfolio, returning the table object. This is not available in Vista yet.

## Parameters:

• Name - String - indicates the name of the portfolio item in the same portfolio
• Page - String (Optional) - indicates the optional page (1 by default)
`	GetTable("MyOtherTable",3).GetCell(10,10)`

# Module

Signals the start of a module e.g.

```	Module AdvancedMath
Export Dim Pi = 3.14159
End Module```

# RowQuestion

Returns the question placed in the rows in a tab-definition

`RowQuestion.Shortcut ' => "gender" if the question in the row`

# RowSubQuestion

Return the first question child of the question placed in the rows. This is extremely useful if you want to have a template that automatically picks on which questions are used and creates a increment weighting for instance.

`RowSubQuestion.Shortcut ' => "Rating" if the question in the row is a loop called Brands who has one sub-question called Rating`

# FindIndexIn

Search for and return the first index position of a value in the specified array: FindIndexIn(set, value)

This keyword returns the position of a specific value in the specified set.

## Parameters:

• Array - Array - Array where the search will be performed
• Value - Number - Value to find in the arra
``` FindIndexIn ( { 1; 5; 3} , 5 ) will return 2.

This is useful to when transforming a question using entry codes into index.```

## ...[return to top of 'Global' section]

The above list of Global keywords is not an exhaustive list, only a selection of particular relevance for Analyse scripts. To see the full list of Global keywords please search the script sections of the askia Design online documentation or open up a script window in Analyse > Documentation > Global.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request