Library Methods

Admin

System administration tools (admins only)


Admin.CPULoad

Return current CPU load as percentage of total available (100.0 is full utilization)

Parameters

None


Admin.MODELSHOP_WEBSERVICE_TRACE

Parameters

None


Admin.allOpenModels

Parameters

None


Admin.applicationMemory

Return application memory available in MB

Parameters

None


Admin.compactModel()

Parameters

None


Admin.configUUID

Parameters

None


Admin.console($String)

Parameters

parameter1

(String)


Admin.cpus

Return current number of logical CPUs)

Parameters

None


Admin.enableProfiling($Object)

Parameters

parameter1

(Object)


Admin.executeShellCommand($String)

Parameters

parameter1

(String)


Admin.executeShellScript($String, $String[])

Parameters

parameter1

(String)

parameter2

(String[])


Admin.freeDiskSpace

Return free disk space on disk where server is installed in MB

Parameters

None


Admin.freeMemory

Return free application memory in MB

Parameters

None


Admin.garbageCollect()

Perform Java garbage collection

Parameters

None


Admin.getModelshopProperty($Object)

Parameters

parameter1

(Object)


Admin.getSystemProperty($Object)

Parameters

parameter1

(Object)


Admin.javaVersion

Return the Java version

Parameters

None


Admin.killThread()

Parameters

None


Admin.loading

Parameters

None


Admin.memoryUsed

Return used application memory in use in MB

Parameters

None


Admin.modelAutoSaveSec

Display how frequently the model data is saved to cache

Parameters

None

Notes

Only changed data is saved. If the server fails the model will only be backed up to the last save clusterPoint

Admin.modelshopProperties

Parameters

None


Admin.myOpenModels

Parameters

None


Admin.operatingSystem

Return the operating system

Parameters

None


Admin.pauseModelCompact()

Parameters

None


Admin.pauseRecalculate

Is calculating currently paused

Parameters

None


Admin.profilingOn

Parameters

None


Admin.recycleModelshopServer()

Parameters

None


Admin.resumeModelCompact($int)

Parameters

parameter1

(int)


Admin.runCPUBenchmark($millionIterations, $maxThreads)

Run a Java CPU focused benchmark at different threading levels

Parameters

millionIterations

(Object) How many times to execute a million iterations of the math floating test (suggest 1000)

maxThreads

(Object) Run the test from 1 to maxThreads number of threads, typically want to go slightly higher than cpus on box


Admin.runGroovyBenchmark($iterations)

Run a Groovy focused benchmark to determine relative Groovy speed

Parameters

iterations

(Object) How many times to execute the groovy operation using different call techniques (suggest 1_000_000)


Admin.saveModel()

Parameters

None


Admin.saveModelData()

Parameters

None


Admin.serverInfo

Parameters

None


Admin.serverName

Get logical name of server

Parameters

None


Admin.setLogLevel($String, $Object)

Parameters

parameter1

(String)

parameter2

(Object)


Admin.setModelshopProperty($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


Admin.setSystemProperty($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


Admin.stackReporting

Parameters

None


Admin.systemMemory

Return total system memory in MB

Parameters

None


Admin.systemProperties

Parameters

None


Admin.totalDiskSpace

Return total disk space on disk where server is installed in MB

Parameters

None


Admin.usage()

Parameters

None


Admin.usageReport()

Parameters

None


Admin.userDetails

Parameters

None


Admin.userNames

Parameters

None


Analytic

Library for managing analytics embedded in a model


Analytic.analyticServers

Return a map of analytic servers

Parameters

None

Notes

Analytic.analyticServers = {‘python’:PythonAnalyticServer}

Analytic.analytics

Parameters

None


analytic.classifyMe()

Classify current dataitem

Parameters

None


analytic.classifyRecord($record)

Classify a single record using the analytic, returns a classification result

Parameters

record

(Record) A single record, can be a datalist or a Record (e.g. MapRecord)


analytic.classifyRecords($records)

Classify a collection of records using the analytic, returns a collection of classified results

Parameters

records

(Collection<Record>) A collection of records, can be datalists or Records (e.g. MapRecord)


analytic.computeMe()

Compute value for analytic on current dataitem

Parameters

None


analytic.computeRecord($record)

Compute a single record using the analytic, returns a classification result

Parameters

record

(Record) A single record, can be a datalist or a Record (e.g. MapRecord)


analytic.computeRecords($records)

Compute a collection of records using the analytic, returns a collection of classified results

Parameters

records

(Collection<Record>) A collection of records, can be datalists or Records (e.g. MapRecord)


analytic.describe

Return a description of the model

Parameters

None


analytic.fieldNames

Return a list of field names used in scoring the model

Parameters

None


analytic.name

Parameters

None


analytic.predictMe()

Return predicted probability for current dataitem

Parameters

None


analytic.predictRecord($record)

Predict a single record using the analytic, returns a predicted probability

Parameters

record

(Record) A single record, can be a datalist or a Record (e.g. MapRecord)


analytic.predictRecords($records)

Predict a collection of records using the analytic, returns a collection of predicted probability

Parameters

records

(Collection<Record>) A collection of records, can be datalists or Records (e.g. MapRecord)


Analytic.reloadAnalyticServer($serverName)

Reload analytic server information

Parameters

serverName

(String) The name of the analytic server, by default one of ‘h2o’ or ‘python’


analytic.scoreMe()

Score current dataitem

Parameters

None


analytic.scoreRecord($record)

Score a single record using the analytic, returns a record with results

Parameters

record

(Record) A single record, can be a datalist or a Record (e.g. MapRecord)


analytic.scoreRecords($records)

Scores a collection of records using the analytic, returns a collection of items with results

Parameters

records

(Collection<Record>) A collection of records, can be datalists or Records (e.g. MapRecord)


analytic.scoreVector($vector)

Score a data vector using the analytic, returns an item with results

Parameters

vector

(Collection<Object>) A column of data, e.g. Collection<Object> or myList.fieldName


Analytic.setAnalyticServerURL($serverName, $serverUrl)

Change the URL for an analytic server

Parameters

serverName

(String) The name of the analytic server, by default one of ‘h2o’ or ‘python’

serverUrl

(String) The new server URL location, including port, e.g. http://localhost:54321


Archive

Data archive management tools


Archive.archive($tag, $entity, $followAttached)

Archive an entity to a named archive cache, will remove from model after archive

Parameters

tag

(String) Name of an archive, if existing will add, if new will create

entity

(Entity) The entity to archive

followAttached

(boolean) if true, include all attached children


Archive.archive($tag, $entityList, $followAttached)

Archive a list of entitities to a named archive cache, will remove from model after archive

Parameters

tag

(String) Name of an archive, if existing will add, if new will create

entityList

(Collection<Entity>) The list of entities to archive

followAttached

(boolean) if true, include all attached children


Archive.unarchive($tag, $replace)

Unarchive all entities in an archive cache

Parameters

tag

(String) Name of an archive, will fail if not found

replace

(boolean) If true, any unarchived entities that match the key of an existing entity, otherwise merge


Calculate


Calculate.__$stMC

Parameters

None


Calculate.evaluate($expression)

Evaluate an expression

Parameters

expression

(String) An expression to evaluate


Calculate.evaluate($target, $expression)

Evaluate an expression on a given target

Parameters

target

(Object) the target object

expression

(String) An expression to evaluate


Calculate.evaluateFirst($target, $expressionList)

Look for the first valid expression on an object, return null if none found

Parameters

target

(Object) the target object

expressionList

(Object) A list of expressions to evaluate, either array or comma delimited


Calculate.evaluateFirstOrError($target, $expressionList)

Look for the first valid expression on an object, throw an error if none found

Parameters

target

(Object) the target object

expressionList

(Object) A list of expressions to evaluate, either array or comma delimited


Calculate.scriptCache

Parameters

None


Calendar


Color

Provides standard color types and tools


Color.BLACK

Parameters

None


Color.BLUE

Parameters

None


Color.CELL

Parameters

None


Color.CELL_BLACK

Parameters

None


Color.CELL_BLUE

Parameters

None


Color.CELL_DKBLUE

Parameters

None


Color.CELL_DKGREEN

Parameters

None


Color.CELL_DKGREY

Parameters

None


Color.CELL_DKRED

Parameters

None


Color.CELL_DKYELLOW

Parameters

None


Color.CELL_GREEN

Parameters

None


Color.CELL_GREY

Parameters

None


Color.CELL_RED

Parameters

None


Color.CELL_WHITE

Parameters

None


Color.CELL_YELLOW

Parameters

None


Color.DEFAULT_SATURATION

Parameters

None


Color.DKBLUE

Parameters

None


Color.DKGREEN

Parameters

None


Color.DKGREY

Parameters

None


Color.DKRED

Parameters

None


Color.DKYELLOW

Parameters

None


Color.GREEN

Parameters

None


Color.GREY

Parameters

None


Color.RED

Parameters

None


Color.ROW

Parameters

None


Color.ROW_BLACK

Parameters

None


Color.ROW_BLUE

Parameters

None


Color.ROW_DKBLUE

Parameters

None


Color.ROW_DKGREEN

Parameters

None


Color.ROW_DKGREY

Parameters

None


Color.ROW_DKRED

Parameters

None


Color.ROW_DKYELLOW

Parameters

None


Color.ROW_GREEN

Parameters

None


Color.ROW_GREY

Parameters

None


Color.ROW_RED

Parameters

None


Color.ROW_WHITE

Parameters

None


Color.ROW_YELLOW

Parameters

None


Color.WHITE

Parameters

None


Color.YELLOW

Parameters

None


Color.blend($Collection<Integer>)

Parameters

parameter1

(Collection<Integer>)


Color.blend($int, $int, $float)

Parameters

parameter1

(int)

parameter2

(int)

parameter3

(float)


Color.colorBar($color, $barPercent)

Add a bar percent format to the color - the UI will fill color barPercent from left to right (right to left if negative)

Parameters

color

(String) The color of the bar

barPercent

(Object) The percentage to fill the bar - 1 is 100%

Examples

Color.colorBar('0xFF00AA', 1/4) => '0xFF00AA|0.25

Color.fromName($colorName)

Convert a color name into a color

Parameters

colorName

(String) Name of the color

Examples

Color.fromName('Red') => red color

Color.numberToColor($int)

Parameters

parameter1

(int)


Color.rag($value, $lower, $upper)

Return RAG (red, amber, green) color based on where a value falls in a range

Parameters

value

(Object) The value

lower

(Object) Lower bound of range (red)

upper

(Object) Upper bound of range (green)

Notes

If lower bound is higher than higher bound, colors will reverse

Examples

Color.rag(10, 0, 100) => 75% red color

Color.saturate($color, $saturation)

Return a color at a given saturation level

Parameters

color

(String) The base color fully saturated

saturation

(Object) Percentage (0-1) of saturation

Examples

Color.saturate(Color.RED, 0.1) => 10% red color

Color.stopLightBands($red, $yellow, $green, $value)

Return GREEN, YELLOW or RED based bands - if red > green reverse direction used

Parameters

red

(Object) Red threshold

yellow

(Object) Yellow threshold

green

(Object) Green threshold

value

(Object) Value to compare

Examples

Color.stopLightBands(4, 6, 8, 9.5) => GREEN
Color.stopLightBands(4, 6, 8, 6) => YELLOW
Color.stopLightBands(4, 6, 8, -3) => RED

Color.stopLightEquals($target, $actual, $yellowThreshold)

Return GREEN, YELLOW or RED based on equality

Parameters

target

(Object) Target value

actual

(Object) Actual value

yellowThreshold

(Object) Difference if not exceeded returns yellow instead of red

Examples

Color.stopLightEquals(12.0, 12.0, 0.1) => GREEN
Color.stopLightEquals(12.0, 12.05, 0.1) => YELLOW
Color.stopLightEquals(12.0, 12.2, 0.1) => RED

Compare

Provides comparison convenience tools that are type independent


Compare.compare($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


Compare.diff($a, $b)

Compares two values and describes the difference if any

Parameters

a

(Object) first object

b

(Object) second object

Examples

Compare.diff('foo', 'bar') -> 'foo:bar'
Compare.diff(10, 10) -> null
Compare.diff(10,12) -> 2

Compare.equal($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


Compare.greaterThan($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


Compare.greaterThanOrEqual($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


Compare.iff($Object, $Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)

parameter3

(Object)


Compare.in($Collection<Number>, $Number, $Number)

Parameters

parameter1

(Collection<Number>)

parameter2

(Number)

parameter3

(Number)


Compare.in($Collection<Object>, $Object)

Parameters

parameter1

(Collection<Object>)

parameter2

(Object)


Compare.in($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


Compare.lessThan($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


Compare.lessThanOrEqual($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


Compare.notEqual($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


Compare.notIn($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


Connector

Management of model connectors for custom loading and export


connector.alternateSourceLocation

Get alternate external source location for connector

Parameters

None


Connector.connectors

Return a list of all connectors in the model

Parameters

None


connector.data

Submit a request to the web service associated with the connector.

Parameters

None

Notes

This method does not necessarily perform an HTTP GET request. You may have to configure the connector to do a POST or PUT request when form parameters are required.

connector.errors

Return a list of errors for the connecto

Parameters

None


connector.getData($target)

Submit a request to the web service associated with the connector.

Parameters

target

(Entity) Specifies the entity to receive the data

Notes

This method does not necessarily perform an HTTP GET request. You may have to configure the connector to do a POST or PUT request when form parameters are required.

connector.getData($target, $parameters)

Submit a request to the web service associated with the connector.

Parameters

target

(Entity) Specifies the entity to receive the data

parameters

(Map<String,Object>) A map of strings to objects; Each of the entries becomes a binding in the groovy console when evaluating the expressions that define the parameters

Notes

This method does not necessarily perform an HTTP GET request. You may have to configure the connector to do a POST or PUT request when form parameters are required.

connector.getData($target, $parameters, $payload, $raw)

Submit a request to the web service associated with the connector.

Parameters

target

(Entity) Specifies the entity to receive the data

parameters

(Map<String,Object>) A map of strings to objects; Each of the entries becomes a binding in the groovy console when evaluating the expressions that define the parameters

payload

(Object) Typically the request object to be submitted to the online service; This only applies when submitting a POST request.

raw

(boolean) Indicates whether to provide the data in its raw form, or convert it into entities

Notes

This method does not necessarily perform an HTTP GET request. You may have to configure the connector to do a POST or PUT request when form parameters are required.

connector.getData($target, $parameters, $raw)

Submit a request to the web service associated with the connector.

Parameters

target

(Entity) Specifies the entity to receive the data

parameters

(Map<String,Object>) A map of strings to objects; Each of the entries becomes a binding in the groovy console when evaluating the expressions that define the parameters

raw

(boolean) Indicates whether to provide the data in its raw form, or convert it into entities

Notes

This method does not necessarily perform an HTTP GET request. You may have to configure the connector to do a POST or PUT request when form parameters are required.

connector.getErrors($source)

Return a list of errors for the connector source

Parameters

source

(String) Select a specific target source name, leave null if not a multi-source


connector.getFieldStats($source)

Return a list of statistics for the connector source

Parameters

source

(String) Select a specific target source name, leave null if not a multi-source


connector.getSourceInfo($source)

Return summary information for the connector source

Parameters

source

(String) Select a specific target source name, leave null if not a multi-source


connector.getSourceNames($page, $limit)

Return list of source names for connector

Parameters

page

(int) Specifies what portion of the results is desired

limit

(int) Then number of results in a page


connector.headers

Parameters

None


connector.loadConnector($target)

Loads data from connector into the target entity

Parameters

target

(Object) The entity target to load


connector.loadConnector($target, $loadLimit)

Loads data from connector into the target entity with a load limit

Parameters

target

(Object) The entity target to load

loadLimit

(Object) Maximum number of rows to load


connector.loadData($data)

Load data directly into the target datalist as if it had come from the designated data source.

Parameters

data

(Object) The data to be loaded; This may not be null

Notes

Since no target entity is specified, this function makes a new entity in the target datalist where the data is to be stored

connector.loadData($data, $target)

Load data directly into the target datalist as if it had come from the designated data source.

Parameters

data

(Object) The data to be loaded; This may not be null

target

(Entity) Specifies the entity to receive the data; If null, this function makes a new entity in the target datalist


connector.loadRecords($job, $recordCount, $wait)

Load records from a connector, controlling the speed, returns job cursor

Parameters

job

(Job) An existing load job, pass for subsequent calls to continue where left off in load

recordCount

(long) The number of records to allow to load this call - the loader will pause when limit is reached (use 0) to load unlimited

wait

(boolean) true-wait for job to complete or hit count, false-return immediately [can wait with job.wait()]


connector.loadRecords($job, $source, $recordCount, $wait, $discardManualEdits)

Load records from a connector, controlling the speed, returns job cursor

Parameters

job

(Job) An existing load job, pass for subsequent calls to continue where left off in load

source

(String) Select a specific target source name, leave null if all or not a multi-source - for RDBMS, source can be a SQL WHERE clause

recordCount

(long) The number of records to allow to load this call - the loader will pause when limit is reached (use 0) to load unlimited

wait

(boolean) true-wait for job to complete or hit count, false-return immediately [can wait with job.wait()]

discardManualEdits

(boolean) Overwrite data that was entered manually


connector.name

Parameters

None


connector.sourceNames

Return list of source names for connector

Parameters

None


connector.writeRecords($job, $recordCount, $wait)

Write records to a connector, returns job cursor

Parameters

job

(Job) An existing write job (null if new job), provide for subsequent calls to continue where left off in load

recordCount

(long) The number of records to allow to write this call - the writer will pause when limit is reached (use 0) to load unlimited

wait

(boolean) true-wait for job to complete or hit count, false-return immediately [can wait with job.wait()]


connector.writeRecords($job, $source, $recordCount, $wait, $clearTarget)

Write records to a connector, controlling the speed, returns job cursor

Parameters

job

(Job) An existing write job, pass for subsequent calls to continue where left off in load

source

(String) Select a specific target source name, leave null if not a multi-source - for RDBMS, source can be a SQL statement

recordCount

(long) The number of records to allow to write this call - the writer will pause when limit is reached (use 0) to load unlimited

wait

(boolean) true-wait for job to complete or hit count, false-return immediately [can wait with job.wait()]

clearTarget

(null) true-delete all existing records in the connector target prior to writing


Convert

Convenience tools for converting types


Convert.isNumber($Object)

Parameters

parameter1

(Object)


Convert.toBoolean($input)

Converts various inputs values to a true/false value

Parameters

input

(Object) can be number or string

Notes

This function will convert any number other than 0 and a variety of affirmative string phrases, such as “yes”, “y”, and “true” to a boolean true value
The number 0 as well as “no”, “n”, and “false” will be converted to false statements

Examples

Convert.toBoolean(0) = false
Convert.toBoolean(1) = true
Convert.toBoolean("yes") = true
Convert.toBoolean("n") = false

Convert.toCurrency($number)

Converts strings or numbers to currency values and rounds to the second decimal place

Parameters

number

(Object) any number or string representing a number

Examples

Convert.toCurrency(24) = $24.00
Convert.toCurrency(24.3455) = $24.35

Convert.toDate($date)

Converts dates input as string values to date values in the format “yyyy-mm-dd”

Parameters

date

(Object) entered in string format, between double quotations

Examples

Convert.toDate("10/9/2014") = 2014-10-19

Convert.toDate($date, $format)

Converts dates input as string values to date values using the specified format

Parameters

date

(Object) entered in string format, between double quotations

format

(String) the date format of the string input

Notes

This function accommodates various date formats, including m-d-yy; m/d/yy; m.d.yy; mmm d, yy see @dateformats for more formatting options
If no format is specified, then the date will be in the form, “yyy-mm-dd”

Examples

Convert.toDate("10/9/2014") = 2014-10-19
Convert.toDate("10/9/2014", "dd/MM/yyyy") = 2014-09-10
Convert.toDate("10/9/2014", "MM/dd/yyyy") = 2014-10-09

Convert.toFloat($number)

Converts numerical values in string and other number formats to a three decimal float value

Parameters

number

(Object) any number

Examples

Convert.toFloat("2") = 2.000
Convert.toFloat(-12.4565) = -12.457

Convert.toFloatSafe($number)

Converts numerical values in string and other number formats to a three decimal float value - returns null for non parsing float

Parameters

number

(Object) any number

Examples

Convert.toFloat("2") = 2.000
Convert.toFloat(-12.4565) = -12.457
Convert.toFloat('foo') = null

Convert.toInteger($number)

Converts any number to an integer by cutting off the decimal fraction

Parameters

number

(Object) any number

Examples

Convert.toInteger(12.99999) = 12

Convert.toText($input)

Converts the argument to string text

Parameters

input

(Object) any value

Examples

Convert.toText(false) = "false"

Cube

Tools to manipulate model cubes


Cube.cubes

Parameters

None


cube.getNode($Entity)

Parameters

parameter1

(Entity)


cube.name

Parameters

None


cube.nodes

Parameters

None


cube.pivot

Parameters

None


Cube.rollup($source, $destination)

Rollup aggregation from one datalist to another using common field keys

Parameters

source

(EntitySet<Entity>) The datalist that are the source detail records

destination

(EntitySet) The dataset to update with rollup records

Notes

Assumes key

Datagrid

Creation of a navigable data grid


datagrid.column($String)

Parameters

parameter1

(String)


Datagrid.create($Collection<Map<String,Object>>, $String, $Collection<String>)

Parameters

parameter1

(Collection<Map<String,Object>>)

parameter2

(String)

parameter3

(Collection<String>)


datagrid.keyCeiling($Object)

Parameters

parameter1

(Object)


datagrid.keyFloor($Object)

Parameters

parameter1

(Object)


datagrid.keyPosition($Object)

Parameters

parameter1

(Object)


datagrid.size()

Parameters

None


Dataset

Creates a dataset that acts like a datalist, but is independent of the model


dataset.add($entities)

Add a collection of entities to a dataset

Parameters

entities

(Collection<Map<String,Object>>) The entities to be added to the dataset


dataset.add($entities, $columns)

Add a collection of entities to a dataset, keeping selected columns

Parameters

entities

(Collection<Map<String,Object>>) The entities to be added to the dataset

columns

(List<String>) List of columns to include


dataset.add($entities, $keyColumn)

Add a collection of entities to a dataset, and include a fast lookup key

Parameters

entities

(Collection<Map<String,Object>>) The entities to be added to the dataset

keyColumn

(String) Field name for the lookup key


dataset.add($entities, $keyColumn, $columns)

Add a collection of entities to a dataset, keeping selected columns, include a fast lookup key

Parameters

entities

(Collection<Map<String,Object>>) The entities to be added to the dataset

keyColumn

(String) Field name for the lookup key

columns

(List<String>) List of columns to include


dataset.add($entity)

Add a single entity to a dataset, keeping all columns

Parameters

entity

(Map<String,Object>) The entity to be added to the dataset


dataset.add($entity, $columns)

Add a single entity to a dataset, keeping selected columns

Parameters

entity

(Map<String,Object>) The entity to be added to the dataset

columns

(List<String>) List of columns to include


dataset.add($entity, $keyColumn)

Add a single entity to a dataset, and include a fast lookup key

Parameters

entity

(Map<String,Object>) The entity to be added to the dataset

keyColumn

(String) Field name for the lookup key


dataset.add($entity, $keyColumn, $columns)

Add a single entity to a dataset, keeping selected columns and include a fast lookup key

Parameters

entity

(Map<String,Object>) The entity to be added to the dataset

keyColumn

(String) Field name for the lookup key

columns

(List<String>) List of columns to include


dataset.clear()

Delete all of the records in the dataset

Parameters

None


dataset.column($colunnName)

Provide a list all of the objects stored in the specified column in the entire dataset

Parameters

colunnName

(String) The name of the column where the objects are stored


dataset.columns()

Provide a list of columns included in the dataset

Parameters

None


dataset.compute($K, $BiFunction<? super K,? super V,? extends V>)

Parameters

parameter1
parameter2

(BiFunction<? super K,? super V,? extends V>)


dataset.computeIfAbsent($K, $Function<? super K,? extends V>)

Parameters

parameter1
parameter2

(Function<? super K,? extends V>)


dataset.computeIfPresent($K, $BiFunction<? super K,? super V,? extends V>)

Parameters

parameter1
parameter2

(BiFunction<? super K,? super V,? extends V>)


dataset.containsKey($key)

Indicate whether the dataset includes a column whose name matches the key

Parameters

key

(Object) The key to match against the column names


dataset.containsValue($value)

[Not supported] Indicate whether the dataset includes the specified object

Parameters

value

(Object) The value of the object to search for


Dataset.create($entities)

Create a dataset from a list of entities, keeping all columns

Parameters

entities

(Collection<Map<String,Object>>) The list of entities to copy to a dataset


Dataset.create($entities, $columns)

Create a dataset from a list of entities, keeping selected columns

Parameters

entities

(Collection<Map<String,Object>>) The list of entities to copy to a dataset

columns

(List<String>) List of columns to include


Dataset.create($entities, $keyColumn)

Create a dataset from a list of entities, keeping all columns, include a fast lookup key

Parameters

entities

(Collection<Map<String,Object>>) The list of entities to copy to a dataset

keyColumn

(String) Field name for the lookup key


Dataset.create($entities, $keyColumn, $columns)

Create a dataset from a list of entities, keeping selected columns, include a fast lookup key

Parameters

entities

(Collection<Map<String,Object>>) The list of entities to copy to a dataset

keyColumn

(String) Field name for the lookup key

columns

(List<String>) List of columns to include


Dataset.create()

Create an empty dataset

Parameters

None


dataset.empty

Indicate whether the dataset is empty

Parameters

None


dataset.entrySet()

[Not supported] Retrieve all of the objects in the entire data set together with the corresponding key

Parameters

None


dataset.forEach($BiConsumer<? super K,? super V>)

Parameters

parameter1

(BiConsumer<? super K,? super V>)


dataset.get($key)

[Not supported] Retrieve the object corresponding with the specified key

Parameters

key

(Object) The value of the key to search for


dataset.get($key, $colunn)

Retrieve the object stored in the specified column of the record identified by the key

Parameters

key

(Object) The value of the lookup key

colunn

(Object) The name of the column where the object is stored


dataset.getOrDefault($Object, $V)

Parameters

parameter1

(Object)

parameter2

dataset.keyColumn()

Provide the name of the column that is the fast lookup key

Parameters

None


dataset.keySet()

Delete all of the records in the dataset

Parameters

None


dataset.merge($K, $V, $BiFunction<? super V,? super V,? extends V>)

Parameters

parameter1
parameter2
parameter3

(BiFunction<? super V,? super V,? extends V>)


dataset.put($key, $value)

[Not supported] Store the objects according to the specified key

Parameters

key

(Object) The key value

value

(Object) A list of objects to be stored


dataset.putAll($m)

[Not supported] Store each list of objects in the map as specified by the corresponding key

Parameters

m

(Map<String,Object>>) A map of key values to object lists


dataset.putIfAbsent($K, $V)

Parameters

parameter1
parameter2

dataset.record($key)

Retrieve the record identified by the key

Parameters

key

(Object) The value of the lookup key


dataset.records()

Provide a list all of the records in the entire dataset

Parameters

None


dataset.remove($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


dataset.remove($key)

[Not supported] Remove the object corresponding with the specified key

Parameters

key

(Object) The key value


dataset.replace($K, $V)

Parameters

parameter1
parameter2

dataset.replace($K, $V, $V)

Parameters

parameter1
parameter2
parameter3

dataset.replaceAll($BiFunction<? super K,? super V,? extends V>)

Parameters

parameter1

(BiFunction<? super K,? super V,? extends V>)


dataset.set($key, $colunn, $value)

Store the object in the specified column of the record identified by the key

Parameters

key

(Object) The value of the lookup key

colunn

(String) The name of the column where the object is to be stored

value

(Object) The object that is to be stored in the dataset


dataset.size()

Provide the number of records in the dataset

Parameters

None


dataset.values()

[Not supported] Retrieve all of the objects in the entire data set

Parameters

None


Date


Date.DATETIME_COMPARABLE_FORMAT

Parameters

None


Date.DATETIME_FORMAT

Parameters

None


Date.DATE_COMPARABLE_FORMAT

Parameters

None


Date.DATE_FORMAT

Parameters

None


Date.EXCEL_FULL

Parameters

None


Date.FRIDAY

Parameters

None


Date.MONDAY

Parameters

None


Date.MS_DAY

Parameters

None


Date.MS_YEAR

Parameters

None


Date.NULL_DATE

Parameters

None


Date.SATURDAY

Parameters

None


Date.SUNDAY

Parameters

None


Date.THURSDAY

Parameters

None


Date.TUESDAY

Parameters

None


Date.USA

Parameters

None


Date.WEDNESDAY

Parameters

None


date.XMLDate

Parameters

None


Date.XML_FORMAT

Parameters

None


date.ageBusinessDays($Date)

Parameters

parameter1

(Date)


date.ageDays($toDate)

Return the difference between this date and a specified date in whole days

Parameters

toDate

(Object) Later date

Examples

Date.parse('2010-01-01').ageDays() -> 2007 on 2015-06-30

date.ageDays()

Return the difference between this date and today’s date in whole days

Parameters

None

Examples

Date.parse('2010-01-01').ageDays() -> 2007 on 2015-06-30

date.ageDays360($Date)

Parameters

parameter1

(Date)


date.ageHours($toDate)

Return the difference between this date and a specified date in whole hours

Parameters

toDate

(Object) Later date

Examples

Date.parse('2010-01-01 03:10:15').ageHours() -> 2 at 2010-01-01 05:20:15

date.ageHours()

Return the difference between this date and today’s date in whole hours

Parameters

None

Examples

Date.parse('2010-01-01 03:10:15').ageHours() -> 2 at 2010-01-01 05:20:15

date.ageMSec($toDate)

Return the difference between this date and a specified date in whole millisec

Parameters

toDate

(Object) Later date

Examples

Date.parse('2010-01-01 03:10:15.100').ageMSec() -> 7805.100 at 2010-01-01 05:20:15.200

date.ageMSec()

Return the difference between this date and today’s date in whole millisec

Parameters

None

Examples

Date.parse('2010-01-01 03:10:15.100').ageMSec() -> 7805.100 at 2010-01-01 05:20:15.200

date.ageMinutes($toDate)

Return the difference between this date and a specified date in whole minutes

Parameters

toDate

(Object) Later date

Examples

Date.parse('2010-01-01 03:10:15').ageMinutes() -> 130 at 2010-01-01 05:20:15

date.ageMinutes()

Return the difference between this date and today’s date in whole minutes

Parameters

None

Examples

Date.parse('2010-01-01 03:10:15').ageMinutes() -> 130 at 2010-01-01 05:20:15

date.ageMonths($toDate)

Return the difference between this date and a specified date in whole months

Parameters

toDate

(Object) Later date

Examples

Date.parse('2010-01-01').ageMonths() -> 66 on 2015-06-30

date.ageMonths()

Return the difference between this date and today’s date in whole months

Parameters

None

Examples

Date.parse('2010-01-01').ageMonths() -> 66 on 2015-06-30

date.ageSeconds($toDate)

Return the difference between this date and a specified date in whole seconds

Parameters

toDate

(Object) Later date

Examples

Date.parse('2010-01-01 03:10:15').ageSeconds() -> 7805 at 2010-01-01 05:20:20

date.ageSeconds()

Return the difference between this date and today’s date in whole seconds

Parameters

None

Examples

Date.parse('2010-01-01 03:10:15').ageSeconds() -> 7805 at 2010-01-01 05:20:20

date.ageYears($toDate)

Return the difference between this date and a specified date in whole years

Parameters

toDate

(Object) Later date

Examples

Date.parse('2010-01-01').ageYears(2015-06-30) -> 5

date.ageYears()

Return the difference between this date and today’s date in whole years

Parameters

None

Examples

Date.parse('2010-01-01').ageYears() -> 5 on 2015-06-30

date.beginningOfMonth($Number)

Parameters

parameter1

(Number)


date.beginningOfMonth()

Parameters

None


date.beginningOfQuarter()

Parameters

None


date.beginningOfWeek()

Parameters

None


date.beginningOfYear()

Parameters

None


date.businessDay

Parameters

None


date.canEqual($Object)

Parameters

parameter1

(Object)


date.compareTo($Object)

Parameters

parameter1

(Object)


Date.currentTimeMillis()

Return the current clock time in millisec

Parameters

None


Date.date($string)

Create date from string using default formats

Parameters

string

(String) A string representing a date or datetime


Date.date($string, $format)

Create date from string using a specific format

Parameters

string

(String) A string representing a date or datetime

format

(String) A string representing the format for the date

Examples

dd/MM/yyyy, dd-MM-yyyy hh:mm:ss a

Date.date($unixTime)

Create date from string using unix time

Parameters

unixTime

(Long) Millisec since January 1, 1970 UTC

Notes

Note classic Unix time is in seconds, so multiply by 1000 before calling if using classic unix time

Date.date($year, $month, $day)

Create date from string using a year, day, month

Parameters

year

(Object) Year of date

month

(Object) Month of year

day

(Object) day of month


Date.date($year, $month, $day, $hour, $minute, $second)

Create date from string using a year, day, month, hour, minute, second

Parameters

year

(Object) Year of date

month

(Object) Month of year

day

(Object) day of month

hour

(Object) hour of day

minute

(Object) minute of hour

second

(Object) second of minute


date.day

Parameters

None


date.dayOfWeek

Return the day of the week, Monday==1 (ISO)

Parameters

None

Examples

date.dayOfWeek -> 2   (Tuesday)

date.dayOfWeekName

Parameters

None


date.dayOfYear

Parameters

None


date.daysInMonth

Parameters

None


date.endOfMonth

Parameters

None


date.endOfMonth($Number)

Parameters

parameter1

(Number)


date.endOfMonth()

Parameters

None


date.endOfQuarter()

Parameters

None


date.endOfWeek()

Parameters

None


date.endOfYear()

Parameters

None


date.format($format)

Create date from string using a specific format

Parameters

format

(String) A string representing the format for the date

Examples

dd/MM/yyyy, dd-MM-yyyy hh:mm:ss a

Date.fromXmlDate($XMLGregorianCalendar)

Parameters

parameter1

(XMLGregorianCalendar)


date.hour

Return current hour of the day 0-23

Parameters

None

Examples

Date.parse('2010-01-01 15:10:15').getHour() -> 15

date.inRange($beginDate, $endDate)

Return true if the current date is between beginDate and endDate

Parameters

beginDate

(Object) Start date of range

endDate

(Object) End date of range

Examples

date.inRange('2019-01-01', '2019-02-28') -> true

date.instant()

Show the date instant in millisec

Parameters

None


Date.isEqualForgiving($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


date.isHoliday($String)

Parameters

parameter1

(String)


date.isSameDay($Date)

Parameters

parameter1

(Date)


date.isSameMonthYear($Date)

Parameters

parameter1

(Date)


Date.max($Date, $Date)

Parameters

parameter1

(Date)

parameter2

(Date)


date.microsecPrecision

Parameters

None


date.milliSec

Return current millisec 0-999

Parameters

None

Examples

Date.parse('2010-01-01 15:10:15.123').getMilliSec() -> 123

date.milliSecOfDay

Return current millisec of day 86,399,000

Parameters

None

Examples

Date.parse('2010-01-01 15:10:15.123').getMilliSecOfDay() -> 54,915,123

date.millisecPrecision

Parameters

None


Date.min($Date, $Date)

Parameters

parameter1

(Date)

parameter2

(Date)


date.minute

Return current minute 0-59

Parameters

None

Examples

Date.parse('2010-01-01 15:10:15').getMinute() -> 10

date.minuteOfDay

Return current minute of day 0-1439

Parameters

None

Examples

Date.parse('2010-01-01 15:10:15').getMinuteOfDay() -> 915

date.month

Parameters

None


date.nextBusinessDay($Number)

Parameters

parameter1

(Number)


date.nextBusinessDay()

Parameters

None


date.nextWeekday($Number)

Parameters

parameter1

(Number)


Date.now()

Parameters

None


Date.nowNoCache()

Parameters

None


Date.parse($dateText)

Create date from string using a default format

Parameters

dateText

(String) A string representing a date or datetime

Notes

Create a date from a string using one of the default formats listed below: M-d-yyyy HH:mm:ssX, M-d-yyyy h:mm:ss a, M-d-yyyy HH:mm:ss, M-d-yy, M-d-yyyy, M/d/yyyy HH:mm:ssX, M/d/yyyy h:mm:ss a, M/d/yyyy HH:mm:ss, M/d/yy, M/d/yyyy, M.d.yyyy HH:mm:ssX, M.d.yyyy h:mm:ss a, M.d.yyyy HH:mm:ss, M.d.yy, M.d.yyyy, MMM d, yyyy HH:mm:ssX, MMM d, yyyy h:mm:ss a, MMM d, yyyy HH:mm:ss, MMM d, yy, MMM d, yyyy, yyyy-MM-dd HH:mm:ssX, yyyy-MM-dd h:mm:ss a, yyyy-MM-dd HH:mm:ss, yyyy-MM-dd, yyyy/MM/dd HH:mm:ssX, yyyy/MM/dd h:mm:ss a, yyyy/MM/dd HH:mm:ss, yyyy/MM/dd, yyyy.MM.dd HH:mm:ssX, yyyy.MM.dd h:mm:ss a, yyyy.MM.dd HH:mm:ss, yyyy.MM.dd

Examples

Date.parse('Jun 10, 2018')

Date.parse($dateText, $format)

Create date from string using a default format

Parameters

dateText

(String) A string representing a date or datetime

format

(String) A string representing the parse instructions

Notes

Parses text into a date using the supplied format The following pattern letters are defined (all other characters from ‘A’ to ‘Z’ and from ‘a’ to ‘z’ are reserved): Letter Date or Time Component Presentation Examples G Era designator Text AD y Year Year 1996; 96 Y Week year Year 2009; 09 M Month in year Month July; Jul; 07 w Week in year Number 27 W Week in month Number 2 D Day in year Number 189 d Day in month Number 10 F Day of week in month Number 2 E Day name in week Text Tuesday; Tue u Day number of week (1 = Monday, …, 7 = Sunday) Number 1 a Am/pm marker Text PM H Hour in day (0-23) Number 0 k Hour in day (1-24) Number 24 K Hour in am/pm (0-11) Number 0 h Hour in am/pm (1-12) Number 12 m Minute in hour Number 30 s Second in minute Number 55 S Millisecond Number 978 z Time zone General time zone Pacific Standard Time; PST; GMT-08:00 Z Time zone RFC 822 time zone -0800 X Time zone ISO 8601 time zone -08; -0800; -08:00

Pattern letters are usually repeated, as their number determines the exact presentation:

Text: For formatting, if the number of pattern letters is 4 or more, the full form is used; otherwise a short or abbreviated form is used if available. For parsing, both forms are accepted, independent of the number of pattern letters.

Number: For formatting, the number of pattern letters is the minimum number of digits, and shorter numbers are zero-padded to this amount. For parsing, the number of pattern letters is ignored unless it’s needed to separate two adjacent fields.

Year: If the formatter’s Calendar is the Gregorian calendar, the following rules are applied. For formatting, if the number of pattern letters is 2, the year is truncated to 2 digits; otherwise it is interpreted as a number. For parsing, if the number of pattern letters is more than 2, the year is interpreted literally, regardless of the number of digits. So using the pattern “MM/dd/yyyy”, “01/11/12” parses to Jan 11, 12 A.D. For parsing with the abbreviated year pattern (“y” or “yy”), SimpleDateFormat must interpret the abbreviated year relative to some century. It does this by adjusting dates to be within 80 years before and 20 years after the time the SimpleDateFormat instance is created. For example, using a pattern of “MM/dd/yy” and a SimpleDateFormat instance created on Jan 1, 1997, the string “01/11/12” would be interpreted as Jan 11, 2012 while the string “05/04/64” would be interpreted as May 4, 1964. During parsing, only strings consisting of exactly two digits, as defined by Character.isDigit(char), will be parsed into the default century. Any other numeric string, such as a one digit string, a three or more digit string, or a two digit string that isn’t all digits (for example, “-1”), is interpreted literally. So “01/02/3” or “01/02/003” are parsed, using the same pattern, as Jan 2, 3 AD. Likewise, “01/02/-3” is parsed as Jan 2, 4 BC. Otherwise, calendar system specific forms are applied. For both formatting and parsing, if the number of pattern letters is 4 or more, a calendar specific long form is used. Otherwise, a calendar specific short or abbreviated form is used.

If week year ‘Y’ is specified and the calendar doesn’t support any week years, the calendar year (‘y’) is used instead. The support of week years can be tested with a call to getCalendar().isWeekDateSupported().

Month: If the number of pattern letters is 3 or more, the month is interpreted as text; otherwise, it is interpreted as a number.

General time zone: Time zones are interpreted as text if they have names. For time zones representing a GMT offset value, the following syntax is used:

GMTOffsetTimeZone: GMT Sign Hours : Minutes Sign: one of + - Hours: Digit Digit Digit Minutes: Digit Digit Digit: one of 0 1 2 3 4 5 6 7 8 9

Hours must be between 0 and 23, and Minutes must be between 00 and 59. The format is locale independent and digits must be taken from the Basic Latin block of the Unicode standard.

For parsing, RFC 822 time zones are also accepted.

Examples

Date.parse('201801', 'yyyyMM')

Date.parseCheck($dateText, $format)

Verify whether a string matches an expected parse format - returns true/false

Parameters

dateText

(String) A string representing a date or datetime

format

(String) A string representing the parse instructions

Notes

Checks whether text can be parsed into a date using the supplied format The following pattern letters are defined (all other characters from ‘A’ to ‘Z’ and from ‘a’ to ‘z’ are reserved): Letter Date or Time Component Presentation Examples G Era designator Text AD y Year Year 1996; 96 Y Week year Year 2009; 09 M Month in year Month July; Jul; 07 w Week in year Number 27 W Week in month Number 2 D Day in year Number 189 d Day in month Number 10 F Day of week in month Number 2 E Day name in week Text Tuesday; Tue u Day number of week (1 = Monday, …, 7 = Sunday) Number 1 a Am/pm marker Text PM H Hour in day (0-23) Number 0 k Hour in day (1-24) Number 24 K Hour in am/pm (0-11) Number 0 h Hour in am/pm (1-12) Number 12 m Minute in hour Number 30 s Second in minute Number 55 S Millisecond Number 978 z Time zone General time zone Pacific Standard Time; PST; GMT-08:00 Z Time zone RFC 822 time zone -0800 X Time zone ISO 8601 time zone -08; -0800; -08:00

Pattern letters are usually repeated, as their number determines the exact presentation:

Text: For formatting, if the number of pattern letters is 4 or more, the full form is used; otherwise a short or abbreviated form is used if available. For parsing, both forms are accepted, independent of the number of pattern letters.

Number: For formatting, the number of pattern letters is the minimum number of digits, and shorter numbers are zero-padded to this amount. For parsing, the number of pattern letters is ignored unless it’s needed to separate two adjacent fields.

Year: If the formatter’s Calendar is the Gregorian calendar, the following rules are applied. For formatting, if the number of pattern letters is 2, the year is truncated to 2 digits; otherwise it is interpreted as a number. For parsing, if the number of pattern letters is more than 2, the year is interpreted literally, regardless of the number of digits. So using the pattern “MM/dd/yyyy”, “01/11/12” parses to Jan 11, 12 A.D. For parsing with the abbreviated year pattern (“y” or “yy”), SimpleDateFormat must interpret the abbreviated year relative to some century. It does this by adjusting dates to be within 80 years before and 20 years after the time the SimpleDateFormat instance is created. For example, using a pattern of “MM/dd/yy” and a SimpleDateFormat instance created on Jan 1, 1997, the string “01/11/12” would be interpreted as Jan 11, 2012 while the string “05/04/64” would be interpreted as May 4, 1964. During parsing, only strings consisting of exactly two digits, as defined by Character.isDigit(char), will be parsed into the default century. Any other numeric string, such as a one digit string, a three or more digit string, or a two digit string that isn’t all digits (for example, “-1”), is interpreted literally. So “01/02/3” or “01/02/003” are parsed, using the same pattern, as Jan 2, 3 AD. Likewise, “01/02/-3” is parsed as Jan 2, 4 BC. Otherwise, calendar system specific forms are applied. For both formatting and parsing, if the number of pattern letters is 4 or more, a calendar specific long form is used. Otherwise, a calendar specific short or abbreviated form is used.

If week year ‘Y’ is specified and the calendar doesn’t support any week years, the calendar year (‘y’) is used instead. The support of week years can be tested with a call to getCalendar().isWeekDateSupported().

Month: If the number of pattern letters is 3 or more, the month is interpreted as text; otherwise, it is interpreted as a number.

General time zone: Time zones are interpreted as text if they have names. For time zones representing a GMT offset value, the following syntax is used:

GMTOffsetTimeZone: GMT Sign Hours : Minutes Sign: one of + - Hours: Digit Digit Digit Minutes: Digit Digit Digit: one of 0 1 2 3 4 5 6 7 8 9

Hours must be between 0 and 23, and Minutes must be between 00 and 59. The format is locale independent and digits must be taken from the Basic Latin block of the Unicode standard.

For parsing, RFC 822 time zones are also accepted.

Examples

Date.parseCheck('201801', 'yyyyMM') -> true

date.plusBusinessDays($Object)

Parameters

parameter1

(Object)


date.plusDays($Object)

Parameters

parameter1

(Object)


date.plusHours($Object)

Parameters

parameter1

(Object)


date.plusMSec($Object)

Parameters

parameter1

(Object)


date.plusMinutes($Object)

Parameters

parameter1

(Object)


date.plusMonths($Number)

Parameters

parameter1

(Number)


date.plusQuarters($int)

Parameters

parameter1

(int)


date.plusSeconds($Object)

Parameters

parameter1

(Object)


date.plusWeeks($Number)

Parameters

parameter1

(Number)


date.plusYears($Number)

Parameters

parameter1

(Number)


date.quarter

Parameters

None


date.quarterName

Parameters

None


Date.range($beginDate, $endDate, $businessDays)

Create a range of dates between beginDate and endDate inclusive

Parameters

beginDate

(Object) Start date of range

endDate

(Object) End date of range

businessDays

(Object) true for returning business days, null or false for each day

Examples

date.range('2019-01-01', '2019-01-05') -> [2019-01-01, 2019-01-02, 2019-01-03, 2019-01-04, 2019-01-05]

Date.rangeMonths($beginDate, $endDate)

Create a range of month dates between beginDate and endDate inclusive

Parameters

beginDate

(Object) Start date of range

endDate

(Object) End date of range

Examples

date.rangeMonths('2019-01-01', '2019-05-01') -> [2019-01-01, 2019-02-01, 2019-03-01, 2019-04-01, 2019-05-01]

date.roundDay()

Parameters

None


date.roundMonth()

Parameters

None


date.roundWeek()

Parameters

None


date.roundYear()

Parameters

None


date.second

Return current second 0-59

Parameters

None

Examples

Date.parse('2010-01-01 15:10:15').getSecond() -> 15

date.secondOfDay

Return current second of day 0-86,399

Parameters

None

Examples

Date.parse('2010-01-01 15:10:15').getSeconfOfDay() -> 54,915

date.time

Parameters

None


date.timestamp

Parameters

None


Date.toDate($date)

Convert data to a date, handles existing dates, longs or string dates

Parameters

date

(Object) Representation of a date can be string

Examples

Date.toDate('2010-01-01') -> a date

date.toDate()

Parameters

None


date.toDateTime()

Parameters

None


Date.today()

Parameters

None


Date.todayNoCache()

Parameters

None


date.value

Parameters

None


date.week

Parameters

None


date.weekOfMonth

Parameters

None


date.weekday

Parameters

None


Date.xmlDate($String)

Parameters

parameter1

(String)


date.year

Parameters

None


Debug

Tools to manage debugging the model


Debug.clear()

Parameters

None


Debug.counterAdd($Object)

Parameters

parameter1

(Object)


Debug.counterClear($Object)

Parameters

parameter1

(Object)


Debug.counterGet($Object)

Parameters

parameter1

(Object)


Debug.disable()

Parameters

None


Debug.enable()

Parameters

None


Debug.loopCheck($int)

Parameters

parameter1

(int)


Debug.message($Object)

Parameters

parameter1

(Object)


Debug.output

Parameters

None


Debug.velocityRuntimeLog()

Display the location of the velocity log at runtime

Parameters

None


Debug.velocityRuntimeProperties()

Provide a list of properties and their values from the velocity runtime configuration

Parameters

None


Distribution

Mathematical distribution functions


Distribution.MAX_FIT_ITERATIONS

Parameters

None


Distribution.beta($mean, $standardDeviation)

Create a beta distribution

Parameters

mean

(Object) Mean value for the distribution

standardDeviation

(Object) Standard distribution


Distribution.cauchy($mean, $standardDeviation)

Create a Cauchy distribution

Parameters

mean

(Object) Mean value for the distribution

standardDeviation

(Object) Standard distribution


Distribution.chiSquared($degreesOfFreedom)

Create a Chi Squared distribution

Parameters

degreesOfFreedom

(Object) Degrees of freedom for Chi Squared distribution


distribution.cumulativeProbability($xValue)

For a given distribution, given an X value, the cumulative probability (probability a number is this number or lower)

Parameters

xValue

(Object) The value to return the cumulative probability in the distribution

Examples

myDistribution.cumulativeProbability(100) -> '0.345'

distribution.density($xValue)

For a given distribution, given an X value, the density function (the probability of that value on the curve 0-1 at that clusterPoint)

Parameters

xValue

(Object) The value to return the density in the distribution

Examples

myDistribution.density(100) -> '0.0211'

Distribution.exponential($mean)

Create a exponential distribution

Parameters

mean

(Object) Mean value for the distribution


Distribution.gamma($shape, $scale)

Create a Gamma distribution

Parameters

shape

(Object) Mean value for the distribution

scale

(Object) Standard distribution


Distribution.gamma($xValues, $yValues)

Create a Gamma distribution from observed data points

Parameters

xValues

(Collection<Object>) A list of xValues

yValues

(Collection<Object>) A list of yValues

Notes

The x and y value lists must be the same size

Distribution.levy($mu, $c)

Create a Levy distribution

Parameters

mu

(Object) Mean value for the distribution

c

(Object) Standard distribution


Distribution.logNormal($mean, $standardDeviation)

Create a Log Normal distribution

Parameters

mean

(Object) Mean value for the distribution

standardDeviation

(Object) Standard distribution


distribution.maxDensity

For a given distribution, return the peak of the density curve

Parameters

None

Notes

returns Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY if unbounded

Examples

myDistribution.maxDensity -> 0.0211

distribution.maxDensityX

For a given distribution, return the X value that corresponds to the peak of the density curve

Parameters

None

Notes

returns Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY if unbounded

Examples

myDistribution.maxDensityX -> 123.4

distribution.mean

For a given distribution, return the clusterPoint of the mean)

Parameters

None

Examples

myDistribution.mean -> 123.45

distribution.meanDensity

For a given distribution, return the probability density at the mean

Parameters

None

Examples

myDistribution.meanDensity -> '0.0211'

Distribution.multivariateNormal($means, $covariances)

Multivariate Normal does a normal distribution across multiple variables that have covariances

Parameters

means

(Object) A vector of doubles that are mean values

covariances

(Object) A matrix of doubles that are the covariance between each combination of values

Notes

The means vector has to be the same size as the matrix dimensions (square)

Examples

Distribution.multivariateNormal(1234, [3.4, 2.7, 8.1, 12.7, 1.2], {[1,2,3,4,5], [...etc], [], [], []})

Distribution.normal($mean, $standardDeviation)

Create a normal distribution

Parameters

mean

(Object) Mean value for the distribution

standardDeviation

(Object) Standard distribution


Distribution.normal($xValues, $yValues)

Create a normal distribution from observed data points

Parameters

xValues

(Collection<Object>) A list of xValues

yValues

(Collection<Object>) A list of yValues

Notes

The x and y value lists must be the same size

Distribution.normal($xValues, $yValues, $targetMean, $targetSd)

Create a normal distribution from observed data points with target standard deviation

Parameters

xValues

(Collection<Object>) A list of xValues

yValues

(Collection<Object>) A list of yValues

targetMean

(Object) Target mean for fit

targetSd

(Object) Target standard deviation for fit

Notes

The x and y value lists must be the same size

Distribution.pareto($mean, $standardDeviation)

Create a Pareto distribution

Parameters

mean

(Object) Mean value for the distribution

standardDeviation

(Object) Standard distribution


Distribution.poisson($mean, $epsilon)

Create a Poisson distribution

Parameters

mean

(Object) Poisson mean value for the distribution

epsilon

(Object) Convergence criterion


distribution.sample()

For a given distribution, return a random sample for the distribution, typically a single number, but could be a vector (multivariate)

Parameters

None

Examples

myDistribution.sample() -> 123.2

distribution.spreadValue($value, $result)

For a given distribution, given a value, return one of the objects most closely associated with that position in the distribution

Parameters

value

(Object) The value to map to the distribution

result

(Object[]) A list of results (one or more) to split the distribution into

Examples

myDistribution.spreadValue(0.2, 'Low', 'Medium', 'High') -> 'Low'

Distribution.triangular($a, $b, $c)

Create a Triangular distribution

Parameters

a

(Object) Mean value for the distribution

b

(Object) Standard distribution

c

(Object) C value


distribution.variance

For a given distribution, return the variance)

Parameters

None

Examples

myDistribution.mean -> 123.45

Distribution.weibull($mean, $standardDeviation)

Create a Weibull distribution

Parameters

mean

(Object) Mean value for the distribution

standardDeviation

(Object) Standard distribution


Document

Management of unstructured documents like images and pdfs


Document.asImage($document, $imageFormat)

Convert a document to an image

Parameters

document

(DocumentType) Original document

imageFormat

(String) jpg,png,tif

Notes

Accepts JPG, PNG, TIFF, PDF

Document.asThumbnail($document, $imageFormat)

Convert a document to a thumbnail

Parameters

document

(DocumentType) Original document

imageFormat

(String) jpg,png,tif

Notes

Accepts JPG, PNG, TIFF, PDF

Document.clearCache($source)

Clear the document cache for given source, return true if found and deleted

Parameters

source

(String) Source for the document, can be file, url, etc…

Notes

Will remove the cached version of the document, forcing a reload from the original source. Do not call on a document that can’t be retrieved from the original source, the document will be deleted

Document.fromDownload($downloadURL)

Load an image from a web URL

Parameters

downloadURL

(String) URL for downloading a source document

Notes

Accepts JPG, PNG, TIFF, TEXT, JSON files

Document.fromDownload($downloadURL, $userName, $password)

Load an image from a web URL

Parameters

downloadURL

(String) URL for downloading a source document

userName

(String) User name for site authentication

password

(String) Password for site authentication

Notes

Accepts JPG, PNG, TIFF, TEXT, JSON files

Document.fromFile($documentPath)

Load an image from a server local file

Parameters

documentPath

(String) Absolute directory on hosted server to document

Notes

Accepts JPG, PNG, TIFF files

Document.fromWeb($documentURL)

Load an image from a web URL

Parameters

documentURL

(String) Web URL for source document

Notes

Accepts JPG, PNG, TIFF, TEXT, JSON files

Document.fromWeb($documentURL, $userName, $password)

Load an image from a web URL

Parameters

documentURL

(String) Web URL for source document

userName

(String) User name for site authentication

password

(String) Password for site authentication

Notes

Accepts JPG, PNG, TIFF, TEXT, JSON files
See Text.encrypt() and Text.decrypt() for secure password storage options

Document.ocr($document)

Optical Character Recognition (OCR) using Terraset OCR library

Parameters

document

(DocumentType) The image to scan for text

Notes

Accepts JPG, PNG, TIFF files

Error


error.errorInput{it.$field}

Parameters

None


error.errorMessage{it.$field}

Parameters

None


error.isError{it.$field}

Parameters

None


Error.ERROR

Parameters

None


Error.ERROR_BOOLEAN

Parameters

None


Error.ERROR_CURRENCY

Parameters

None


Error.ERROR_DATE

Parameters

None


Error.ERROR_DATETIME

Parameters

None


Error.ERROR_FLOAT

Parameters

None


Error.ERROR_NUMBER

Parameters

None


Error.ERROR_TEXT

Parameters

None


Error.MISSING_STRING

Parameters

None


Error.__$stMC

Parameters

None


Error.catchError($expression)

If no error in value, return value, otherwise return an error token

Parameters

expression

(Closure<?>) an expression to return value for (or error code if error)

Notes

If not caught, an error will propagate up to any calculations or rules calling this expression
NOTE: using catchError is about twice as slow as calling the expression directly

Examples

Error.catchError{ 1/0 } -> Error.ERROR
Error.catchError{ 1/2 } -> 0.5

Error.error($errorText)

Register an error for this entity

Parameters

errorText

(Object) Text of the error to register

Notes

Returns an error object with info about the error

Examples

Error.error{'This is really bad'}

Error.errorInput($expression)

Return the input value that was not successfully applied to a field

Parameters

expression

(Closure<?>) an expression to check for an error input

Examples

record.dateField = '02/31/2018';  Error.errorInput(record.dateField) -> '02/31/2018'

Error.errorMessage($expression)

Return the error message if there is one for an expression

Parameters

expression

(Closure<?>) an expression to check for an error message

Examples

record.dateField = '02/31/2018';  Error.errorMessage(record.dateField) -> 'Can not convert 02/31/2018 to a date'

Error.errors

Return all errors in the model as a collection of type EntityError

Parameters

None

Examples

def ee = Error.errors()[0];  ee.entity -> myEntity, ee.error -> ErrorDetail

Error.exception($errorText)

Throw an exception up the calculation stack

Parameters

errorText

(Object) Text of the exception to register

Notes

Throws an error to the calling calculation, will halt the calculation

Examples

Error.exception{'This is really, really bad - don't continue'}

Error.getErrors($dataList)

Return all errors in the model as a collection of type EntityError

Parameters

dataList

(Object) The datalist to retrieve errors from (can be name, collection or single entity)

Examples

Error.errors(MyEntityList) ->  [MyEntity, Error][]

Error.info($infoText)

Register a information message for this entity

Parameters

infoText

(Object) Text of the information to register

Notes

Returns an error object with info about the error

Examples

Error.info{'This isn't bad, just letting you know'}

Error.isError($expression)

Check to see if a value or expression is an error - requires closure, so {} instead of ()

Parameters

expression

(Closure<?>) an expression to check for an error

Examples

Error.isError{ 1/0 } -> true

Error.isErrorOrNull($expression)

Check to see if a value or expression is an error or null - requires closure, so {} instead of ()

Parameters

expression

(Closure<?>) an expression to check for an error

Examples

Error.isErrorOrNull{ 1/0 } -> true, Error.isErrorOrNull{ null } -> true

Error.warning($warningText)

Register a warning for this entity

Parameters

warningText

(Object) Text of the warning to register

Notes

Returns an error object with info about the error

Examples

Error.warning{'This is sorta bad'}

Files

External file manipulation tools (admin only)


Files.copyFile($fromPath, $toPath)

Copy a file from one location to another

Parameters

fromPath

(String) Source file path location

toPath

(String) Destination path location

Notes

Requires admin rights. File access is limited to files shared with Modelshop server

Files.directoryList($path)

Return a list of file patch in a given directory

Parameters

path

(String) Absolute path to directory on hosted server

Notes

Requires admin rights. File access is limited to files shared with Modelshop server

Files.directoryList($path, $suffixList)

Return a list of files in a given directory

Parameters

path

(String) Absolute path to directory on hosted server

suffixList

(Object) An array, single or comma separated list of suffixes to filter on

Notes

Requires admin rights. File access is limited to files shared with Modelshop server

Files.moveFile($fromPath, $toPath)

Move a file from one location to another

Parameters

fromPath

(String) Source file path location

toPath

(String) Destination path location

Notes

Requires admin rights. File access is limited to files shared with Modelshop server

Files.writeFile($path, $content, $append)

Return a list of file patch in a given directory, return true if successful

Parameters

path

(String) Absolute path to directory on hosted server

content

(Object) Content to write to file

append

(Object) if false or missing, replace existing content, if true append to existing content

Notes

Requires admin rights. File access is limited to files shared with Modelshop server

Finance

Financial calculation tools


Finance.duration($settlement, $coupon, $yield, $frequency)

Returns the weighted average of the cash flows’ present value; used as a measure of a bond price’s response to changes in yield

Parameters

settlement

(Object) security’s settlement date, defined as the date following the issue date when security is traded to the buyer

coupon

(Object) the security’s annual coupon rate

yield

(Object) annual yield

frequency

(Object) number of coupon payments per year


Finance.fv($rate, $nper, $pmt, $pv)

Returns the future value of an investment

Parameters

rate

(Object) interest rate per period (r)

nper

(Object) total payment periods in an annuity (nper)

pmt

(Object) payment made each period, typically consisting of the principal and interest; cannot change over the life of the annuity

pv

(Object) present value, or value of a series of future periodic payments at current time

Notes

Emulates Excel/Calc’s FV(interest_rate, number_payments, payment, PV, Type) function,
which calculates future value or principal at period N.
Returns <code>double</code> representing future principal value.

Finance.fv($rate, $nper, $pmt, $pv, $type)

Returns the future value of an investment

Parameters

rate

(Object) interest rate per period (r)

nper

(Object) total payment periods in an annuity (nper)

pmt

(Object) payment made each period, typically consisting of the principal and interest; cannot change over the life of the annuity

pv

(Object) present value, or value of a series of future periodic payments at current time

type

(Object) indicates when payments are due; 0 = at end of period; 1 = at beginning of period

Notes

Emulates Excel/Calc’s FV(interest_rate, number_payments, payment, PV, Type) function,
which calculates future value or principal at period N.
Returns <code>double</code> representing future principal value.

Finance.ipmt($rate, $per, $nper, $pv)

Returns the interest for a given period for a periodic constant interest rate investment

Parameters

rate

(Object) interest rate per period (r)

per

(Object) the period for which you want to find the interest; must be within range 1 to nper

nper

(Object) total number of payment periods in an annuity

pv

(Object) present value, or value of a series of future periodic payments at current time

Notes

Emulates Excel/Calc’s IPMT(interest_rate, period, number_payments, PV, FV, Type) function,
which calculates the portion of the payment at a given period that is the interest on the
previous balance.
Returns <code>double</code> representing the interest portion of the payment.

Finance.ipmt($rate, $per, $nper, $pv, $fv)

Returns the interest for a given period for a periodic constant interest rate investment

Parameters

rate

(Object) interest rate per period (r)

per

(Object) the period for which you want to find the interest; must be within range 1 to nper

nper

(Object) total number of payment periods in an annuity

pv

(Object) present value, or value of a series of future periodic payments at current time

fv

(Object) future value, or desired cash balance after the last payment is made

Notes

Emulates Excel/Calc’s IPMT(interest_rate, period, number_payments, PV, FV, Type) function,
which calculates the portion of the payment at a given period that is the interest on the
previous balance.
Returns <code>double</code> representing the interest portion of the payment.

Finance.ipmt($rate, $per, $nper, $pv, $fv, $type)

Returns the interest for a given period for a periodic constant interest rate investment

Parameters

rate

(Object) interest rate per period (r)

per

(Object) the period for which you want to find the interest; must be within range 1 to nper

nper

(Object) total number of payment periods in an annuity

pv

(Object) present value, or value of a series of future periodic payments at current time

fv

(Object) future value, or desired cash balance after the last payment is made

type

(Object) indicates when payments are due; 0 = at end of period; 1 = at beginning of period

Notes

Emulates Excel/Calc’s IPMT(interest_rate, period, number_payments, PV, FV, Type) function,
which calculates the portion of the payment at a given period that is the interest on the
previous balance.
Returns <code>double</code> representing the interest portion of the payment.

Finance.irr($values)

Provides the internal rate of return for a series of cash flows

Parameters

values

(List<Number>) list of cash flow calculations


Finance.irr($values, $guess)

Provides the internal rate of return for a series of cash flows

Parameters

values

(List<Number>) list of cash flow calculations

guess

(Number) value to start optimization, leave null to start at 10% for 12 periods

Notes

Emulates Excel’s IRR calculation

Finance.nper($rate, $pmt, $pv, $fv, $type)

Returns the number of periods for an investment with periodic, constant payments and a constant interest rate

Parameters

rate

(Object) interest rate per period (r)

pmt

(Object) payment made each period, typically consisting of the principal and interest; cannot change over the life of the annuity

pv

(Object) present value, or value of a series of future periodic payments at current time

fv

(Object) future value, or desired cash balance after the last payment is made

type

(Object) indicates when payments are due; 0 = at end of period; 1 = at beginning of period


Finance.npv($rate, $payments)

Provides the net present value of a series of payments

Parameters

rate

(Object) the expected discount rate during each period when payments are to be made or received

payments

(Object[]) An array of numeric values representing the amount of each payment


Finance.pmt($rate, $nper, $pv)

Calculates payment for a loan with constant payments and interest rate

Parameters

rate

(Object) interest rate for the loan

nper

(Object) total number of payments for the loan

pv

(Object) present value or principal; value of a series of future periodic payments at current time

Notes

Emulates Excel/Calc’s PMT(interest_rate, number_payments, PV, FV, Type) function,
which calculates the payments for a loan or the future value of an investment
Returns <code>double</code> representing periodic payment amount.

Finance.pmt($rate, $nper, $pv, $fv)

Calculates payment for a loan with constant payments and interest rate

Parameters

rate

(Object) interest rate for the loan

nper

(Object) total number of payments for the loan

pv

(Object) present value or principal; value of a series of future periodic payments at current time

fv

(Object) future value, or desired cash balance after the last payment is made

Notes

Emulates Excel/Calc’s PMT(interest_rate, number_payments, PV, FV, Type) function,
which calculates the payments for a loan or the future value of an investment
Returns <code>double</code> representing periodic payment amount.

Finance.pmt($rate, $nper, $pv, $fv, $type)

Calculates payment for a loan with constant payments and interest rate

Parameters

rate

(Object) interest rate for the loan

nper

(Object) total number of payments for the loan

pv

(Object) present value or principal; value of a series of future periodic payments at current time

fv

(Object) future value, or desired cash balance after the last payment is made

type

(Object) indicates when payments are due; 0 = at end of period; 1 = at beginning of period

Notes

Emulates Excel/Calc’s PMT(interest_rate, number_payments, PV, FV, Type) function,
which calculates the payments for a loan or the future value of an investment
Returns <code>double</code> representing periodic payment amount.

Finance.ppmt($rate, $per, $nper, $pv)

Calculates the payment on principal for a given period for an investment with periodic, constant payments and a constant interest rate

Parameters

rate

(Object) interest rate per period (r)

per

(Object) the period for which you want to find the interest; must be within range 1 to nper

nper

(Object) total number of payment periods in an annuity

pv

(Object) present value, or value of a series of future periodic payments at current time

Notes

Emulates Excel/Calc’s PPMT(interest_rate, period, number_payments, PV, FV, Type) function,
which calculates the portion of the payment at a given period that will apply to the principal.
Returns <code>double</code> representing principal portion of the payment.

Finance.ppmt($rate, $per, $nper, $pv, $fv)

Calculates the payment on principal for a given period for an investment with periodic, constant payments and a constant interest rate

Parameters

rate

(Object) interest rate per period (r)

per

(Object) the period for which you want to find the interest; must be within range 1 to nper

nper

(Object) total number of payment periods in an annuity

pv

(Object) present value, or value of a series of future periodic payments at current time

fv

(Object) future value, or desired cash balance after the last payment is made

Notes

Emulates Excel/Calc’s PPMT(interest_rate, period, number_payments, PV, FV, Type) function,
which calculates the portion of the payment at a given period that will apply to the principal.
Returns <code>double</code> representing principal portion of the payment.

Finance.ppmt($rate, $per, $nper, $pv, $fv, $type)

Calculates the payment on principal for a given period for an investment with periodic, constant payments and a constant interest rate

Parameters

rate

(Object) interest rate per period (r)

per

(Object) the period for which you want to find the interest; must be within range 1 to nper

nper

(Object) total number of payment periods in an annuity

pv

(Object) present value, or value of a series of future periodic payments at current time

fv

(Object) future value, or desired cash balance after the last payment is made

type

(Object) indicates when payments are due; 0 = at end of period; 1 = at beginning of period

Notes

Emulates Excel/Calc’s PPMT(interest_rate, period, number_payments, PV, FV, Type) function,
which calculates the portion of the payment at a given period that will apply to the principal.
Returns <code>double</code> representing principal portion of the payment.

Finance.pv($rate, $nper, $pmt, $fv, $type)

Returns the present value of an investment

Parameters

rate

(Object) interest rate per period (r)

nper

(Object) total payment periods in an annuity (nper)

pmt

(Object) payment made each period, typically consisting of the principal and interest; cannot change over the life of the annuity

fv

(Object) future value, or value of a series of a periodic series of payments at some future time

type

(Serializable) indicates when payments are due; 0 = at end of period; 1 = at beginning of period


Finance.rate($nper, $pmt, $pv)

Calculate the rate based on future payments

Parameters

nper

(Object) Number of periods

pmt

(Object) Regular payment each period

pv

(Object) Present value


Finance.rate($nper, $pmt, $pv, $fv, $type, $guess)

Returns the interest rate per period of an annuity

Parameters

nper

(Object) total number of payment periods in an annuity

pmt

(Object) payment made each period, typically consisting of the principal and interest; cannot change over the life of the annuity

pv

(Object) present value, or value of a series of future periodic payments at current time

fv

(Object) future value, or desired cash balance after the last payment is made

type

(Object) indicates when payments are due; 0 = at end of period; 1 = at beginning of period

guess

(Object) an initial interest rate guess for harder solver problems


Finance.xirr($values, $dates, $guess)

Emulates Excel’s XIRR calculation

Parameters

values

(List) list of cash flow values

dates

(List) list of cash flow dates

guess

(Object) value to start optimization, leave null to start at 10% for 12 periods


Finance.yield($settlement, $maturity, $rate, $price, $redemption, $frequency)

Calculates the yield on a security that pays periodic interest

Parameters

settlement

(Date) security’s settlement date, defined as the date following the issue date when security is traded to the buyer

maturity

(Date) the date when the security expires

rate

(Object) the security’s annual coupon rate

price

(Object) the security’s price per $100 face value

redemption

(Object) the security’s redemption value per $100 face value

frequency

(Object) number of coupon payments per year


Format

Utilities to manage the formatting of data


Format.currency($value)

Format the specified object as an amount of national currency

Parameters

value

(Object) The object to be formatted


Format.date($value)

Format the specified object as a date

Parameters

value

(Object) The object to be formatted


Format.datetime($value)

Format the specified object as a date and time

Parameters

value

(Object) The object to be formatted


Format.dollar($value)

Format the specified object as a dollar value

Parameters

value

(Object) The object to be formatted


Format.formatObject($formatString, $source)

Format the a string from a source object using ${fieldName} syntax

Parameters

formatString

(String) The template string for the format

source

(Object) Any object that has attributes to supply the format string

Examples

Format.formatString('The quick ${color} dog jumped over the lazy ${animal}', [color: 'brown', animal: 'dog'])

Format.formatString($formatString, $source)

Format the a string from a source object using ${fieldName} syntax

Parameters

formatString

(String) The template string for the format

source

(Object[]) A comma delimited set of values that positionally fill in the string

Examples

Format.formatString('The quick %s dog jumped over the lazy %s', 'brown', 'dog') = 'The quick brown dog jumped over the lazy dog'

Format.integer($value)

Format the specified object as an integer

Parameters

value

(Object) The object to be formatted


Format.number($number, $format)

Provide a string representation of the specified numeric value formatted as specified

Parameters

number

(Object) The numeric value to be formatted

format

(String) A modelshop format specifier

Notes

The format specifier is like a format specified in the datalist editor.

Examples

number(1123.456, "#,##0.00") == "1,123.46"
number(0.1234566, "0.000%") == "12.346%"

Format.number($value)

Format the specified object as a floating clusterPoint number

Parameters

value

(Object) The object to be formatted


Histogram


Histogram.BIN_FIELD

Parameters

None


Histogram.BY_FIELD

Parameters

None


Histogram.COUNT_FIELD

Parameters

None


Histogram.create($Collection<Object>)

Parameters

parameter1

(Collection<Object>)


Histogram.createBins($Collection<Object>, $Object)

Parameters

parameter1

(Collection<Object>)

parameter2

(Object)


histogram.plot()

Parameters

None


histogram.print()

Parameters

None


histogram.records

Parameters

None


histogram.setBinning($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


Info

Provides additional information about the runtime model structure


Info.currentUser

Get the name of the current logged in user

Parameters

None

Examples

Info.getCurrentUser() -> 'johnsmith'

Info.entityName

Get the name of the current entity that is being calculated

Parameters

None

Examples

Info.getEntityName() -> 'Employee'

Info.fieldName

Get the name of the current field that is being calculated

Parameters

None

Examples

Info.getFieldName() -> 'testField'

Info.getFieldType($target, $fieldName)

Returns the field type on a target object

Parameters

target

(Object) the angle in radians

fieldName

(String) the name of the field to return type for

Examples

Info.getFieldType(employee, 'salary') -> CURRENCY

Info.isValidField($target, $fieldName)

Returns true if this is a valid field name on the target object

Parameters

target

(Object) the angle in radians

fieldName

(String) the name of the field to check

Examples

Info.isValidField(employee, 'salary') -> true

Jobs

Tools to manage jobs running in the model


Jobs.jobs

Get a list of current active jobs

Parameters

entityType

(null) Name of entity type or entity list

keys

(null) Array of ItemKeys


Jobs.runJob($closure)

Run closure as a job, don’t wait for it to complete

Parameters

closure

(Closure) The logic you want to run as a job

Examples

Jobs.runJob{for (int i=0; i < 1_000_000; i++)}

Jobs.runJobWait($closure)

Run closure as a job, wait for it to complete

Parameters

closure

(Closure) The logic you want to run as a job

Examples

Jobs.runJobWait{for (int i=0; i < 1_000_000; i++)}

Jobs.terminateCurrentJob()

Terminate this job - forcing it to quit even if stuck

Parameters

None


Jobs.terminateJob($job)

Terminate a job

Parameters

job

(Object) A job or jobId to terminate


Jobs.terminateJobForce($job)

Terminate a job - forcing it to quit even if stuck

Parameters

job

(Object) A job or jobId to terminate


Key

Tools to manipulate keys and MultiKeys


Key.collectMultiKeys($keyCollection)

Collect all MultiKeys found in passed structure of collections to a flat list

Parameters

keyCollection

(Object) A source of MultiKeys, single, collection or collection of collections

Notes

Will return a full list (non-unique) of all keys found in order found

Examples

Key.collectMultiKeys([k1,k2],[k1, k3]) == [k1, k2, k1, k3]

Key.fromKey($keyString)

Convert a multi-key or a string representation of a : delimited string to a list of values (deprecated)

Parameters

keyString

(Object) A string key concatenated with :

Notes

Deprecated - use fromMultiKey

Examples

Key.fromKey('1:foo') == [1, 'foo']

Key.fromMultiKey($multiKey)

Convert a multi-key or a string representation of a multi-key to a list of values (deprecated)

Parameters

multiKey

(Object) A multi-key object

Notes

Deprecated - use fromMultiKey

Examples

Key.fromKey(myMultiKeyField) == [1, 'foo']

Key.permutations($values[]…)

Create a permutation of all combinations of multiple key lists

Parameters

values[]…

(Object[]) One or more lists of values

Examples

Key.permutations([1,2,3],[A,B,C]) == ['1:A', 1:B', 1:C', '2:A', '2:B', '2:C', '3:A', '3:B', '3:C']

Key.toKey($keys…)

Convert a list of values to a : delimited string type (deprecated)

Parameters

keys…

(Object[]) A comma separated list of keys

Notes

Deprecated - use toMultKey

Examples

Key.toKey(1, 'foo') == '1:foo'

Key.toMultiKey($keyString)

Convert a list of values to a multi-key type (deprecated)

Parameters

keyString

(Object) A string with keys separated by a ‘:’

Notes

Deprecated - use toMultKey

Examples

Key.toKey(1, 'foo') == '1:foo' (a multikey)

Key.toMultiKey($keys…)

Convert a list of values to a multi-key type (deprecated)

Parameters

keys…

(Object[]) A comma separated list of keys

Notes

Deprecated - use toMultKey

Examples

Key.toKey(1, 'foo') == '1:foo' (a multikey)

Key.tree($collectTree[]…)

Create a tree of keys based on an iteration of iterations

Parameters

collectTree[]…

(Object[]) A collection of collections at each tree level

Notes

Example is run for 2019, 2020 in Q1 2020 (note each reportYearList returns its own quarter secondary key

Examples

Key.permutations(reportYearList, reportYearList.collect{it.quarter) == ['2019:Q1', '2019:Q2', '2019:Q3', '2019:Q4', '2020:Q1']

LinearRegression

Multiple implementations of linear regression analytics


linearRegression.RSquare

Parameters

None


linearRegression.XSumSquares

Parameters

None


linearRegression.addData($double, $double)

Parameters

parameter1

(double)

parameter2

(double)


linearRegression.addData($double[][])

Parameters

parameter1

(double[][])


linearRegression.addObservation($double[], $double)

Parameters

parameter1

(double[])

parameter2

(double)


linearRegression.addObservations($double[][], $double[])

Parameters

parameter1

(double[][])

parameter2

(double[])


linearRegression.append($SimpleRegression)

Parameters

parameter1

(SimpleRegression)


linearRegression.clear()

Parameters

None


LinearRegression.create($dataset, $targetColumn)

Create a multiple linear regression using all fields on a dataset

Parameters

dataset

(Dataset) A dataset containing training data

targetColumn

(String) Name of target column


LinearRegression.create($dataset, $targetColumn, $columns)

Create a multiple linear regression using a list of fields on a dataset

Parameters

dataset

(Dataset) A dataset containing training data

targetColumn

(String) Name of target column

columns

(List<String>) Collection of X column names


LinearRegression.create($entities, $targetColumn)

Create a multiple linear regression using all fields on entities

Parameters

entities

(Collection<Map<String,Object>>) Collection of Modelshop entities

targetColumn

(String) Name of target column


LinearRegression.create($entities, $targetColumn, $columns)

Create a multiple linear regression using a list of fields on entities

Parameters

entities

(Collection<Map<String,Object>>) Collection of Modelshop entities

targetColumn

(String) Name of target column

columns

(List<String>) Collection of X column names


LinearRegression.create($xValues, $yValues)

Create a simple linear regression from x, y values

Parameters

xValues

(Collection<Object>) Collection of X numbers

yValues

(Collection<Object>) Collection of Y numbers


LinearRegression.create($xVector, $yVector)

Create a simple linear regression

Parameters

xVector

(Vector) Vector of X numbers

yVector

(Vector) Vector of Y numbers


LinearRegression.create($yValues)

Create a simple linear regression from an array

Parameters

yValues

(Collection<Number>) Collection of Y numbers


linearRegression.getSlopeConfidenceInterval($double)

Parameters

parameter1

(double)


linearRegression.hasIntercept()

Parameters

None


linearRegression.intercept

Parameters

None


linearRegression.interceptStdErr

Parameters

None


linearRegression.meanSquareError

Parameters

None


linearRegression.n

Parameters

None


linearRegression.predict($double)

Parameters

parameter1

(double)


linearRegression.r

Parameters

None


linearRegression.regress($int[])

Parameters

parameter1

(int[])


linearRegression.regress()

Parameters

None


linearRegression.regressionSumSquares

Parameters

None


linearRegression.removeData($double, $double)

Parameters

parameter1

(double)

parameter2

(double)


linearRegression.removeData($double[][])

Parameters

parameter1

(double[][])


linearRegression.significance

Parameters

None


linearRegression.slope

Parameters

None


linearRegression.slopeConfidenceInterval

Parameters

None


linearRegression.slopeStdErr

Parameters

None


linearRegression.sumOfCrossProducts

Parameters

None


linearRegression.sumSquaredErrors

Parameters

None


linearRegression.totalSumSquares

Parameters

None


Lists

Helper tools for the manipulation of lists


Lists.gatherUnique($Collection)

Parameters

parameter1

(Collection)


Lists.random($Collection)

Parameters

parameter1

(Collection)


LoanCalculator

Tools to handle more advanced loan rate and APR calculations


LoanCalculator.apr($List<LoanCalculator$Payment>)

Parameters

parameter1

(List<LoanCalculator$Payment>)


LoanCalculator.apr360($List<LoanCalculator$Payment>)

Parameters

parameter1

(List<LoanCalculator$Payment>)


LoanCalculator.paymentSchedule($Number, $Number, $Number, $Number, $Number, $Number, $Date)

Parameters

parameter1

(Number)

parameter2

(Number)

parameter3

(Number)

parameter4

(Number)

parameter5

(Number)

parameter6

(Number)

parameter7

(Date)


LoanCalculator.paymentSchedule($Number, $Number, $Number, $Number, $Number, $Number, $Date, $Date, $Number, $List<LoanCalculator$Disbursement>, $Boolean)

Parameters

parameter1

(Number)

parameter2

(Number)

parameter3

(Number)

parameter4

(Number)

parameter5

(Number)

parameter6

(Number)

parameter7

(Date)

parameter8

(Date)

parameter9

(Number)

parameter10

(List<LoanCalculator$Disbursement>)

parameter11

(Boolean)


LoanCalculator.paymentSchedule($loanAmount, $rate, $term, $firstPayment)

Calculates the schedule of payments of a loan with a rate adjustment - on rate adjustment, amortization period will restart for remaining term

Parameters

loanAmount

(Number) amount of loan

rate

(Number) fixed interest rate (per month - divide by 12 if rate is annual)

term

(Number) term of loan in months

firstPayment

(Date) Date of first loan period payment

Notes

List of Finance.Payment structures containing * period - the current payment period, beginning with 1 * principal - payment towards principal in this payment * interest - payment towards interest in this payment * payment - total payment (principal + interest) * principalRemain - remaining amount of principal on the loan

LoanCalculator.totalFees($List<LoanCalculator$Payment>)

Parameters

parameter1

(List<LoanCalculator$Payment>)


LoanCalculator.totalInterest($List<LoanCalculator$Payment>)

Parameters

parameter1

(List<LoanCalculator$Payment>)


LoanCalculator.totalPayments($List<LoanCalculator$Payment>)

Parameters

parameter1

(List<LoanCalculator$Payment>)


LogNormal

Log Normal distribution analytics


LogNormal.create($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


LogNormal.create($Object, $Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)

parameter3

(Object)


LogNormal.create()

Parameters

None


logNormal.cumulativeProbability($Number)

Parameters

parameter1

(Number)


logNormal.density($Number)

Parameters

parameter1

(Number)


logNormal.logDensity($Number)

Parameters

parameter1

(Number)


logNormal.numericalMean

Parameters

None


logNormal.numericalVariance

Parameters

None


logNormal.probability($Number, $Number)

Parameters

parameter1

(Number)

parameter2

(Number)


logNormal.sample()

Parameters

None


logNormal.scale

Parameters

None


logNormal.shape

Parameters

None


logNormal.supportConnected

Parameters

None


logNormal.supportLowerBound

Parameters

None


logNormal.supportLowerBoundInclusive

Parameters

None


logNormal.supportUpperBound

Parameters

None


logNormal.supportUpperBoundInclusive

Parameters

None


Logger

Tools to manage logging for the model and the server


Logger.error($context, $message)

Log an error for the model

Parameters

context

(String) Arbitrary code used to find the error

message

(String) Error message


Logger.info($context, $message)

Log an informational message for the model

Parameters

context

(String) Arbitrary code used to find the message

message

(String) Informational message


Logger.print($output)

Write an object to the script’s output. Will not append a newline to the given input.

Parameters

output

(Object) object to write. If not already a string, will write out the object’s string representation.


Logger.println($output)

Write an object to the script’s output along with a newline character.

Parameters

output

(Object) object to write. If not already a string, will write out the object’s string representation.


Logger.system($context, $message)

Log a system error for the whole platform (requires administrator rights)

Parameters

context

(String) Arbitrary code used to find the error

message

(String) Error message


Logger.warning($context, $message)

Log a warning for the model

Parameters

context

(String) Arbitrary code used to find the warning

message

(String) Warning message


Lookup

Convenience Tools to make lookup of data easier


Lookup.addKey($keys, $field, $compare, $value)

Add a key to existing keyset from a name, value pair with comparitor

Parameters

keys

(List<ItemKey>) Existing keys

field

(String) Key field name

compare

(String) Comparison type: <, <=, >, >=, !=

value

(Comparable) Value to compare


Lookup.addKey($keys, $field, $value)

Add a key to existing keyset from a name, value pair

Parameters

keys

(List<ItemKey>) Existing keys

field

(String) Key field name

value

(Comparable) Value to compare


Lookup.caller($entityType)

Find the entity that’s calling this logic

Parameters

entityType

(Object) Name of entity type or entity list


Lookup.findAllCellValues($Object)

Return a complete list of unique cell values in the table

Parameters

parameter1

(Object)


Lookup.findColumnsWithCell($records, $value)

Search records for cells containing value and return all matching columns - not fast

Parameters

records

(Object) The list of records to search - e.g. a datalist

value

(Object) The value to search for


Lookup.findFailedKey($entityType, $keys)

Find any keys that fail on lookup

Parameters

entityType

(Object) Name of entity type or entity list

keys

(List<ItemKey>) Array of ItemKeys


Lookup.findInRange($entityType, $lowFieldName, $highFieldName, $matchValue)

Find a single rows that where supplied value is greater or equal than low field and less than or equal to high field

Parameters

entityType

(Object) Name of entity type or entity list

lowFieldName

(String) Name of low end range field

highFieldName

(String) Name of high end range field

matchValue

(Object) Value to match on


Lookup.findRow($entityType, $keys)

Find single row that matches a list of keys

Parameters

entityType

(Object) Name of entity type or entity list

keys

(List<ItemKey>) Array of ItemKeys


Lookup.findRowExact($entityType, $fieldName, $matchValue)

Find a single rows that matches a field value pair

Parameters

entityType

(Object) Name of entity type or entity list

fieldName

(String) Name of field to search on

matchValue

(Object) Value to match on


Lookup.findRowLike($entityType, $fieldName, $likeString)

Find single row where field matches regEx like expression

Parameters

entityType

(Object) Name of entity type or entity list

fieldName

(String) Name of field to search on

likeString

(Object) RegEx string to match


Lookup.findRows($entityType, $keys)

Find all rows that match a list of keys

Parameters

entityType

(Object) Name of entity type or entity list

keys

(List<ItemKey>) Array of ItemKeys


Lookup.findRowsExact($entityType, $fieldName, $matchValue)

Find a collection of rows that match a field value pair

Parameters

entityType

(Object) Name of entity type or entity list

fieldName

(String) Name of field to search on

matchValue

(Object) Value to match on


Lookup.findRowsLike($entityType, $fieldName, $likeString)

Find all rows where field matches regEx like expression

Parameters

entityType

(Object) Name of entity type or entity list

fieldName

(String) Name of field to search on

likeString

(String) RegEx string to match


Lookup.findRowsWithCell($records, $value)

Search records for cells containing value and return all matching rows - not fast

Parameters

records

(Object) The list of records to search - e.g. a datalist

value

(Object) The value to search for


Lookup.getAllRows($entityType)

Get all rows for a given class type

Parameters

entityType

(Object) Name of entity type or entity list


Lookup.getAllRows($entityType, $key)

Get all rows that match a given single key

Parameters

entityType

(Object) Name of entity type or entity list

key

(ItemKey) Single ItemKey


Lookup.getKey($field, $compare, $value)

Create a key from a name, value pair with comparitor

Parameters

field

(String) Key field name

compare

(String) Comparison type: <, <=, >, >=, !=

value

(Comparable) Value to compare


Lookup.getKey($field, $value)

Create a key from a name, value pair

Parameters

field

(String) Key field name

value

(Comparable) Key value


Lookup.getLookupMap($entityType, $keyField)

Find the entity that’s calling this logic

Parameters

entityType

(Object) Name of entity type or entity list

keyField

(String) name of key field to use as key


Lookup.getLookupMap($entityType, $keyField, $keyPrefix)

Find the entity that’s calling this logic

Parameters

entityType

(Object) Name of entity type or entity list

keyField

(String) name of key field to use as key

keyPrefix

(String) String prefix to append to beginning of key with :


Lookup.getLookupValue($entityType, $keyField, $valueField)

Return a map of values based on a lookup list, key value and value value

Parameters

entityType

(Object) Name of entity type or entity list

keyField

(String) Name of key field to use as key

valueField

(String) Name of value field


Lookup.getLookupValue($entityType, $keyField, $valueField, $keyPrefix)

Return a map of values based on a lookup list, key value and value value

Parameters

entityType

(Object) Name of entity type or entity list

keyField

(String) Name of key field to use as key

valueField

(String) Name of value field

keyPrefix

(String) A string prefix to append to front of key with :


Mail


Mail.sendMail($toAddress, $fromName, $replyAddress, $subject, $message)

Send a simple email

Parameters

toAddress

(Object) A comma delimited list of to: addresses

fromName

(Object) The name the mail should come from (if null, no name will be specified)

replyAddress

(Object) The reply-to email address (if null, will use the configured system address)

subject

(Object) Subject line

message

(Object) The body of the message

Notes

Requires email server to be configured - see on-premise install guide, currently requires the model owner to have admin rights

Examples

Mail.sendMail('hello@modelshop.com, support@modelshop.com', 'Tom Tobin', 'tomtobin@modelshop.com','Greetings from model: '+model.name, 'Here are the results: ' + model.results

Mail.sendMailHTML($toAddress, $fromName, $replyAddress, $subject, $message)

Send a formatted (HTML) email

Parameters

toAddress

(Object) A comma delimited list of to: addresses

fromName

(Object) The name the mail should come from (if null, no name will be specified)

replyAddress

(Object) The reply-to email address (if null, will use the configured system address)

subject

(Object) Subject line

message

(Object) The body of the message, in HTML form

Notes

Requires email server to be configured - see on-premise install guide, currently requires the model owner to have admin rights

Examples

Mail.sendMail('hello@modelshop.com, support@modelshop.com', 'Tom Tobin', 'tomtobin@modelshop.com','<h2>Greetings from model: '+model.name, '<h2><br>Here are the results: ' + model.results

Maps

Library for managing map structures


Maps.map()

Parameters

None


Maps.maxValue($map)

Return the map entry with the maximum value

Parameters

map

(Map) A map


Maps.minValue($map)

Return the map entry with the minimum value

Parameters

map

(Map) A map


Math

Generalized math functions


Math.E

Parameters

None


Math.IEEEremainder($number, $numer)

Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard

Parameters

number

(Number) dividend

numer

(Number) divisor

Examples

Math.IEEEremainder(4,3) = 1
Math.IEEEremainder(4,2) = 0

Math.PI

Parameters

None


Math.abs($number)

Returns the distance of a value from 0

Parameters

number

(Number) any number

Examples

Math.abs(2) = 2
Math.abs(-2) = 2

Math.acos($number)

Returns the arc cosine of a value; the returned radian angle is in the range 0.0 through pi

Parameters

number

(Number) any number between -1 and 1

Examples

Math.acos(0.5) = 1.047

Math.asin($number)

Returns the arc sine of a value; the returned radian angle is in the range -pi/2 through pi/2

Parameters

number

(Number) any number between -1 and 1

Examples

Math.asin(0.5) = 0.524

Math.atan($number)

Returns the arc tangent of a value; the returned radian angle is in the range -pi/2 through pi/2

Parameters

number

(Number) any number

Examples

Math.atan(0.5) = 0.464

Math.atan2($number, $number)

Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta)

Parameters

number

(Number) the y coordinate

number

(Number) the x coordinate

Examples

Math.atan2(2,3) = 0.785

Math.average($values)

Returns the average of a list of arguments

Parameters

values

(Object[]) A list of values, can be numeric or string

Examples

Math.average(3,2,1) = 2

Math.cbrt($number)

Returns the cube root of the argument

Parameters

number

(Number) any number

Examples

Math.cbrt(8) = 2

Math.ceil($number)

Returns the smallest integer greater than or equal to the argument

Parameters

number

(Number) any number

Examples

Math.ceil(1) = 1
Math.ceil(1.5) = 2
Math.ceil(-1.5) = -1

Math.copySign($number, $number)

Returns the magnitude of the first argument with the sign of the second input

Parameters

number

(Number) magnitude

number

(Number) sign

Examples

Math.copySign(10,1) = 10
Math.copySign(10,-1) = -10

Math.cos($number)

Returns the cosine of an angle in radians

Parameters

number

(Number) the angle in radians

Examples

Math.cos(1.5) = 0.071

Math.cosh($number)

Returns the hyperbolic cosine of a value

Parameters

number

(Number) any number

Examples

Math.cosh(1.5) = 2.352

Math.exp($number)

Returns e raised to the power of the input value

Parameters

number

(Number) the exponent of the function

Examples

Math.exp(2) = e^2 = 7.389

Math.expm1($number)

Returns (e^x) - 1

Parameters

number

(Number) the exponent of the function

Examples

Math.expm1(2) = 6.389

Math.floatEquals($number, $number)

Return true if float numbers are equal with precision grace

Parameters

number

(Number) first number

number

(Number) second number

Examples

Math.floatEquals(1.234567890999999, 1.234567890)==true

Math.floor($number)

Returns the largest (closest to positive infinity) value that is less than or equal to the argument and is equal to a mathematical integer

Parameters

number

(Object) any number

Examples

Math.floor(1.5) = 1
Math.floor(-1.5) = -2

Math.getExponent($Number)

Parameters

parameter1

(Number)


Math.hypot($number, $number)

Returns sqrt(x2 +y2) without intermediate overflow or underflow

Parameters

number

(Number) x value

number

(Number) y value

Examples

Math.hypot(2,2) = 2.828

Math.log($number)

Takes the natural logarithm of the argument

Parameters

number

(Number) any number

Examples

Math.log(1) = 0
Math.log(10) = 2.303

Math.log10($number)

Takes the natural logarithm base 10 of the argument

Parameters

number

(Number) any number

Examples

Math.log10(100) = 2

Math.log1p($number)

Returns the natural logarithm of the sum of the argument and 1

Parameters

number

(Number) any number

Examples

Math.log1p(2) = 1.099

Math.max($values)

Returns the greater of a list of arguments

Parameters

values

(Object[]) A list of values, can be numeric or string

Examples

Math.max(3,2,1) = 3

Math.min($values)

Returns the lesser of a list of arguments

Parameters

values

(Object[]) A list of values, can be numeric or string

Examples

Math.min(3, 2,1) = 1

Math.nextAfter($Number, $Number)

Parameters

parameter1

(Number)

parameter2

(Number)


Math.nextUp($Number)

Parameters

parameter1

(Number)


Math.pctGrowth($from, $to)

Returns the percent growth from first number to second

Parameters

from

(Number) starting value

to

(Number) ending value

Examples

Math.pctGrowth(10, 15) = 1.5

Math.pow($base, $exponent)

Returns the value of the first argument raised to the power of the second argument

Parameters

base

(Object) base number

exponent

(Object) exponent

Examples

Math.pow(4,2) = 16

Math.random($number)

Returns a random number between 0-1 with a random seed

Parameters

number

(Number) any number

Examples

Math.random(300) = 0.673462

Math.random()

Returns a Double value with a positive sign, greater than or equal to 0.0 and less than 1.0.

Parameters

None

Examples

Math.random() = 0.296

Math.randomBetween($number, $number)

Returns a random number between the two arguments

Parameters

number

(Object) lower limit

number

(Object) upper limit

Examples

Math.randomBetween(2,10) = 4.551

Math.randomBetweenInt($number, $number)

Returns a random number between the two arguments, rounded to an integer

Parameters

number

(Object) lower limit

number

(Object) upper limit

Examples

Math.randomBetweenInt(2,10) = 4

Math.randomReset($seed)

Reset the random seed

Parameters

seed

(Object) any integer number

Examples

Math.random(300) = 0.673462

Math.rint($number)

Returns the DOUBLE value that is closest in value to the argument and is equal to a mathematical integer

Parameters

number

(Number) any number

Examples

Math.rint(25.567) = 26.00

Math.round($number)

Round up or down to the nearest whole number

Parameters

number

(Object) Number to round

Examples

Math.round(123.456789) == 123
Math.round(123.556789) == 124

Math.round($number, $digits)

Round to a given number of digits (up if over half)

Parameters

number

(Object) Number to round

digits

(Object) Decimal points to round to (negative implies rounding to 10s (-1), 100s (-2) etc

Examples

Math.round(123.456789, 2) == 123.45
Math.round(123.456789, -1) == 120.0

Math.roundDown($number)

Round down to the nearest whole number

Parameters

number

(Number) a floating number

Examples

Math.roundDown(3.6)==3.0
Math.roundDown(3.4)==3.0

Math.roundDown($number, $digits)

Round down to a given number of digits

Parameters

number

(Object) Number to round

digits

(Object) Decimal points to round to (negative implies rounding to 10s (-1), 100s (-2) etc

Examples

Math.round(123.456789, 2) == 123.45
Math.round(123.456789, -1) == 120.0

Math.roundDownTo($number, $precision)

Round down to a given precision level

Parameters

number

(Number) Number to round

precision

(Number) Precision to round to

Examples

Math.roundTo(123.456789, 0.01) == 123.45
Math.roundTo(123.456789, 10) == 120.0
Math.roundTo(123.456789, 0.5) == 123.5

Math.roundFirstDigit($number)

Round to the first digit precision, used for getting a rough, rounded magnitude

Parameters

number

(Object) a floating number

Examples

Math.roundFirstDigit(34580.20)==30000.0
Math.roundFirstDigit(0.3589)==0.4
Math.roundFirstDigit(9.9023)==10.0

Math.roundOff($number)

Attempt to round off trailing double precision

Parameters

number

(Object) a floating number

Examples

Math.roundOff(3.666666666666666666666666666)==3.66666666
Math.roundOff(5.123000000000000000000000001)==5.123

Math.roundTo($number, $precision)

Round (up or down based on 0.5 split) to a given precision level

Parameters

number

(Number) Number to round

precision

(Number) Precision to round to

Examples

Math.roundTo(123.456789, 0.01) == 123.45
Math.roundTo(123.456789, 10) == 120.0
Math.roundTo(123.456789, 0.5) == 123.5

Math.roundUp($number)

Round up to the nearest whole number

Parameters

number

(Number) a floating number

Examples

Math.roundUp(3.6)==4.0
Math.roundUp(3.4)==4.0

Math.roundUp($number, $digits)

Round up to a given number of digits

Parameters

number

(Object) Number to round

digits

(Object) Decimal points to round to (negative implies rounding to 10s (-1), 100s (-2) etc

Examples

Math.round(123.456789, 2) == 123.45
Math.round(123.456789, -1) == 120.0

Math.roundUpTo($number, $precision)

Round up to a given precision level

Parameters

number

(Number) Number to round

precision

(Number) Precision to round to

Examples

Math.roundUp(123.456789, 0.01) == 123.46
Math.roundUp(123.456789, 10) == 130.0
Math.roundUp(123.456789, 0.5) == 124.0

Math.scalb($Number, $Number)

Parameters

parameter1

(Number)

parameter2

(Number)


Math.signum($number)

Returns the signum function of the argument; zero if the argument is zero, 1.0 if the argument is greater than zero, -1.0 if the argument is less than zero

Parameters

number

(Number) any number

Examples

Math.signum(-0.5) = -1.0
Math.signum(10) = 1.0

Math.sin($number)

Returns the trigonometric sine of an angle in radians

Parameters

number

(Number) the angle in radians

Examples

Math.sin(1.5) = 0.997

Math.sinh($number)

Returns the hyperbolic sine of a DOUBLE value

Parameters

number

(Number) any number

Examples

Math.sinh(1.5) = 2.129

Math.sqrt($number)

Returns a number that is equal to the input value when multiplied by itself

Parameters

number

(Number) any number

Examples

Math.sqrt(49) = 7

Math.tan($number)

Returns the trigonometric tangent of an angle

Parameters

number

(Number) the angle in radians

Examples

Math.tan(1) = 1.557

Math.tanh($number)

Returns the hyperbolic tangent of a DOUBLE value sign

Parameters

number

(Number) any number

Examples

Math.tanh(1.5) = 0.905

Math.toDegrees($number)

Converts an angle measured in radians to an approximately equal angle measured in degrees

Parameters

number

(Number) an angle in radians

Examples

Math.toDegrees(1) = 57.296

Math.toRadians($number)

Converts an angle measured in degrees to an approximately equivalent angle measured in radians

Parameters

number

(Number) an angle in degrees

Examples

Math.toRadians(60) = 1.047

Math.ulp($number)

Returns the size of an ulp of the argument

Parameters

number

(Number) any number

Examples

Math.ulp(956.294) = 1.1368683772161603E-13
Math.ulp(123.1) = 1.4210854715202004E-14

Math.valueInRange($rangeLow, $rangeHigh, $value)

Return how far a value is in range

Parameters

rangeLow

(Object) Beginning of range

rangeHigh

(Object) End of Range

value

(Object) Target value

Examples

Math.inRange(100, 200, 120) == 20

ModelSetup

Utilities to adjust the model structure using functions


ModelSetup.addCalculation($datalist, $fieldName, $type, $expression)

Add a calculation to a datalist, and go into edit mode

Parameters

datalist

(Object) Name of datalist or the datalist reference

fieldName

(String) The name of the field to add

type

(String) Field type text: TEXT, FLOAT, INTEGER, DATE, BOOLEAN, ANY, DATAITEM

expression

(String) Syntax for the calculation


ModelSetup.addDatalist($datalist)

Get a datalist configuration from the current model. If not found, make a new datalist. Go into edit mode.

Parameters

datalist

(String) Name of datalist or the datalist reference


ModelSetup.addField($datalist, $fieldName, $type)

Add a field to a datalist, and go into edit mode

Parameters

datalist

(Object) Name of datalist or the datalist reference

fieldName

(String) The name of the field to add

type

(String) Field type text: TEXT, FLOAT, INTEGER, DATE, BOOLEAN, ANY, DATAITEM


ModelSetup.addReference($DataItemReference)

Parameters

parameter1

(DataItemReference)


ModelSetup.addReference($String, $String, $InfoDataItem)

Parameters

parameter1

(String)

parameter2

(String)

parameter3

(InfoDataItem)


ModelSetup.beginEdit()

Begin editing the current model configuration

Parameters

None

Notes

It is OK to execute this method more than once. After the first time, it has no effect until saveChanges executes.

ModelSetup.build()

Rebuild the model after ModelSetup changes made

Parameters

None

Notes

The model must be saved using ModelSetup.saveChanges() first

ModelSetup.buildDirty

Parameters

None


ModelSetup.createDatalist($datalistName, $description, $metadata)

Create a datalist from metadata, returns DataItemConfig

Parameters

datalistName

(String) Name of the datalist to create - will fail if exists

description

(String) description for datalist

metadata

(Collection) Collection of map (e.g. datalist) with needed metadata for fields

Notes

Expected metadata fields (ignores missing columns, Field is only required):
field:Name of field
description:Description for field
type:Field type, case insensitive - e.g. text, number, dataitem
array:If true or 1, field is an array
dataitem:If type dataitem, the name of linked dataitem
select:If type dataitem, the selection field
minimum:Minimum range value if numeric
maximum:Maximum range value if numeric
mean:Mean value if numberic
stdDev:Standard Deviation value if numeric
precision:Precision - e.g. 0.01 for cents, 5 for multiples of 5
values:List of possible values, comma separated

ModelSetup.createField($datalistName, $fieldName, $metadata)

Create a datalist from metadata, returns DataItemConfig

Parameters

datalistName

(String) Name of the datalist to create - will fail if exists

fieldName

(String) Name of the field to add

metadata

(Object) Map (e.g. datalist) with needed metadata for fields

Notes

Expected metadata fields (ignores missing columns, Field is only required):
field:Name of field
description:Description for field
type:Field type, case insensitive - e.g. text, number, dataitem
format:Field format
array:If true or 1, field is an array
dataitem:If type dataitem, the name of linked dataitem
select:If type dataitem, the selection field
minimum:Minimum range value if numeric
maximum:Maximum range value if numeric
mean:Mean value if numberic
stdDev:Standard Deviation value if numeric
precision:Precision - e.g. 0.01 for cents, 5 for multiples of 5
values:List of possible values, comma separated

ModelSetup.createRule($rulebase, $ruleName, $metadata)

Create a rule from metadata

Parameters

rulebase

(Object) Name of the rulebase to updata

ruleName

(String) Name of the rule to add

metadata

(Object) Map (e.g. datalist) with needed metadata for rule

Notes

Expected metadata fields (ignores missing columns, Field is only required):
name:Name of rule
ruleClass:Class of rule
code:Rule code

ModelSetup.createView($datalistName, $viewName, $metadata)

Create a view from metadata, returns ViewConfig

Parameters

datalistName

(String) Name of the datalist to create - will fail if exists

viewName

(String) name of view

metadata

(Collection) Collection of map with needed metadata for view

Notes

Expected metadata fields (ignores missing columns, Field is only required):
field:Name of field

ModelSetup.dataDirty

Parameters

None


ModelSetup.datalists

Get a collection of all the datalist configurations in the current model

Parameters

None


ModelSetup.deleteDatalist($datalist)

Remove a datalist configuration from the current model, and go into edit mode

Parameters

datalist

(Object) Name of datalist or the datalist reference


ModelSetup.deleteDatalists($dataLists)

Remove a datalist configuration from the current model, and go into edit mode

Parameters

dataLists

(Collection) A collection of datalists


ModelSetup.deleteField($datalist, $fieldName)

Delete a data field from a datalist, and go into edit mode

Parameters

datalist

(Object) Name of datalist or the datalist reference

fieldName

(String) The name of the field to be deleted


ModelSetup.discardChanges()

Discard revisions to the current model configuration, and exit edit mode

Parameters

None


ModelSetup.editMode

Indicates whether the current model configuration is undergoing edits

Parameters

None


ModelSetup.getDatalist($datalist)

Get a datalist configuration from the current model

Parameters

datalist

(Object) Name of datalist or the datalist reference


ModelSetup.getField($datalist, $fieldName)

Get a data field configuration from a datalist

Parameters

datalist

(Object) Name of datalist or the datalist reference

fieldName

(String) The name of the field requested


ModelSetup.getRulebase($rulebase)

Get a rulebase configuration from the current model

Parameters

rulebase

(Object) Name of a rulebase


ModelSetup.getView($viewName)

Get a view configuration from the current model

Parameters

viewName

(Object) Name of view or the view Config reference


ModelSetup.loadModelTypesXSD($xsdPath, $rootEntityName, $typeMap, $ignores, $includes)

Read a local XSD file and populate model structure from it

Parameters

xsdPath

(String) local machine path to xsd file

rootEntityName

(String) name of top entity to hold results

typeMap

(Map<String,String>) A map <string,string> of expected type names to primitive types

ignores

(Collection<String>) a regex list of element types or element names to ignore (null ignore none)

includes

(Collection<String>) a regex list of element types or element names to include (null include all)


ModelSetup.modelConfig

Get the current model configuration

Parameters

None

Notes

When in edit mode, this method provides the actual config. When not in edit mode, it provides a copy of the config. Use beginEdit and saveChanges to go in and out of edit mode, respectively.

ModelSetup.rulebases

Get a collection of all the rulebase configurations in the current model

Parameters

None


ModelSetup.saveChanges()

Save revisions to the current model configuration, and exit edit mode

Parameters

None


ModelSetup.setMathPrecisionFloat()

Parameters

None


ModelSetup.setMathPrecisionFull()

Parameters

None


ModelSetup.suggestReferences()

Parameters

None


ModelSetup.views

Get a list of views from the current model

Parameters

None


MonteCarlo

Monte Carlo simulation tool


MonteCarlo.create($Collection<Distribution>)

Parameters

parameter1

(Collection<Distribution>)


monteCarlo.generateSamples($int)

Parameters

parameter1

(int)


Normal

Normal distribution tools


Normal.beta($mean, $standardDeviation)

Create a beta distribution

Parameters

mean

(Object) Mean value for the distribution

standardDeviation

(Object) Standard distribution


Normal.cauchy($mean, $standardDeviation)

Create a Cauchy distribution

Parameters

mean

(Object) Mean value for the distribution

standardDeviation

(Object) Standard distribution


Normal.chiSquared($degreesOfFreedom)

Create a Chi Squared distribution

Parameters

degreesOfFreedom

(Object) Degrees of freedom for Chi Squared distribution


Normal.create($mean, $standardDeviation)

Create a normal distribution with specified mean and standard deviation.

Parameters

mean

(double) The mean for the distribution

standardDeviation

(double) The standard deviation for the distribution


Normal.create($mean, $standardDeviation, $inverseCumAccuracy)

Create a normal distribution with specified mean and standard deviation and inverse cumulative distribution accuracy.

Parameters

mean

(double) The mean for the distribution

standardDeviation

(double) The standard deviation for the distribution

inverseCumAccuracy

(double) The inverse cumulative accuracy


Normal.create()

Create a normal distribution, where the mean and standard deviation of the normally distributed natural logarithm of the log-normal distribution are equal to zero and one respectively.

Parameters

None


normal.cumulativeProbability($Number)

Parameters

parameter1

(Number)


normal.cumulativeProbability($xValue)

For a given distribution, given an X value, the cumulative probability (probability a number is this number or lower)

Parameters

xValue

(Object) The value to return the cumulative probability in the distribution

Examples

myDistribution.cumulativeProbability(100) -> '0.345'

normal.density($Number)

Parameters

parameter1

(Number)


normal.density($xValue)

For a given distribution, given an X value, the density function (the probability of that value on the curve 0-1 at that clusterPoint)

Parameters

xValue

(Object) The value to return the density in the distribution

Examples

myDistribution.density(100) -> '0.0211'

Normal.exponential($mean)

Create a exponential distribution

Parameters

mean

(Object) Mean value for the distribution


Normal.gamma($shape, $scale)

Create a Gamma distribution

Parameters

shape

(Object) Mean value for the distribution

scale

(Object) Standard distribution


Normal.gamma($xValues, $yValues)

Create a Gamma distribution from observed data points

Parameters

xValues

(Collection<Object>) A list of xValues

yValues

(Collection<Object>) A list of yValues

Notes

The x and y value lists must be the same size

normal.inverseCumulativeProbability($Number)

Parameters

parameter1

(Number)


Normal.levy($mu, $c)

Create a Levy distribution

Parameters

mu

(Object) Mean value for the distribution

c

(Object) Standard distribution


normal.logDensity($Number)

Parameters

parameter1

(Number)


Normal.logNormal($mean, $standardDeviation)

Create a Log Normal distribution

Parameters

mean

(Object) Mean value for the distribution

standardDeviation

(Object) Standard distribution


normal.maxDensity

Parameters

None


normal.maxDensityX

Parameters

None


normal.mean

Parameters

None


normal.meanDensity

For a given distribution, return the probability density at the mean

Parameters

None

Examples

myDistribution.meanDensity -> '0.0211'

Normal.multivariateNormal($means, $covariances)

Multivariate Normal does a normal distribution across multiple variables that have covariances

Parameters

means

(Object) A vector of doubles that are mean values

covariances

(Object) A matrix of doubles that are the covariance between each combination of values

Notes

The means vector has to be the same size as the matrix dimensions (square)

Examples

Distribution.multivariateNormal(1234, [3.4, 2.7, 8.1, 12.7, 1.2], {[1,2,3,4,5], [...etc], [], [], []})

Normal.normal($mean, $standardDeviation)

Create a normal distribution

Parameters

mean

(Object) Mean value for the distribution

standardDeviation

(Object) Standard distribution


Normal.normal($xValues, $yValues)

Create a normal distribution from observed data points

Parameters

xValues

(Collection<Object>) A list of xValues

yValues

(Collection<Object>) A list of yValues

Notes

The x and y value lists must be the same size

Normal.normal($xValues, $yValues, $targetMean, $targetSd)

Create a normal distribution from observed data points with target standard deviation

Parameters

xValues

(Collection<Object>) A list of xValues

yValues

(Collection<Object>) A list of yValues

targetMean

(Object) Target mean for fit

targetSd

(Object) Target standard deviation for fit

Notes

The x and y value lists must be the same size

normal.normalDistribution

Parameters

None


normal.numericalVariance

Parameters

None


Normal.pareto($mean, $standardDeviation)

Create a Pareto distribution

Parameters

mean

(Object) Mean value for the distribution

standardDeviation

(Object) Standard distribution


Normal.poisson($mean, $epsilon)

Create a Poisson distribution

Parameters

mean

(Object) Poisson mean value for the distribution

epsilon

(Object) Convergence criterion


normal.probability($Number, $Number)

Parameters

parameter1

(Number)

parameter2

(Number)


normal.sample()

Parameters

None


normal.scale

Parameters

None


normal.spreadValue($value, $result)

For a given distribution, given a value, return one of the objects most closely associated with that position in the distribution

Parameters

value

(Object) The value to map to the distribution

result

(Object[]) A list of results (one or more) to split the distribution into

Examples

myDistribution.spreadValue(0.2, 'Low', 'Medium', 'High') -> 'Low'

normal.standardDeviation

Parameters

None


normal.supportConnected

Parameters

None


normal.supportLowerBound

Parameters

None


normal.supportLowerBoundInclusive

Parameters

None


normal.supportUpperBound

Parameters

None


normal.supportUpperBoundInclusive

Parameters

None


Normal.triangular($a, $b, $c)

Create a Triangular distribution

Parameters

a

(Object) Mean value for the distribution

b

(Object) Standard distribution

c

(Object) C value


normal.variance

For a given distribution, return the variance)

Parameters

None

Examples

myDistribution.mean -> 123.45

Normal.weibull($mean, $standardDeviation)

Create a Weibull distribution

Parameters

mean

(Object) Mean value for the distribution

standardDeviation

(Object) Standard distribution


Number


Number.inRange($value, $from, $to)

Returns true if number is in range (inclusive)

Parameters

value

(Object) Value to compare

from

(Object) From range value

to

(Object) To range value

Examples

Number.inRange(2.3, 2.0, 3.0) == true

Number.isNumber($value)

Return true if value is a number type

Parameters

value

(Object) Value to check if number

Examples

Number.isNumber(2.3) == true, Number.isNumber('foo') == false

Objects

Tools for the manipulation of objects


Objects.copyObject($object)

Make a copy of any object

Parameters

object

(Object) The object to copy

Notes

This is for raw object types. For entities, use myEntity.copy()

Objects.getAttributes($object)

Return the attributes on an object

Parameters

object

(Object) The object to return attributes for

Notes

This is for raw object types. For entities, use myEntity.fieldNames

Plugins


Random

Random distribution and generator tools


Random.random($number)

Returns a random number between 0-1 with a random seed

Parameters

number

(long) any number

Examples

Random.random(300) = 0.673462

Random.random()

Returns a Double value with a positive sign, greater than or equal to 0.0 and less than 1.0.

Parameters

None

Examples

Random.random() = 0.296

Random.randomBetween($number, $number)

Returns a random number between the two arguments

Parameters

number

(Object) lower limit

number

(Object) upper limit

Examples

Random.randomBetween(2,10) = 4.551

Random.randomList($element)

Returns a random element from a list

Parameters

element

(Object[]) a comma separated list of values

Examples

Random.randomList('foo', 'bar', 'bae') = 'bar'

Random.randomReset($seed)

Reset the random seed

Parameters

seed

(Object) any integer number

Examples

Random.random(300) = 0.673462

Record

Support for record types that are independent of datalists


record.clear()

Parameters

None


record.columns

Parameters

None


Record.compare($leftSide, $rightSide)

Compare two records and return differences in form of field : [left, right]

Parameters

leftSide

(Map<String,Object>) Left side record

rightSide

(Map<String,Object>) Right side record

Examples

Record.compare(record1, record2) -> { foo : [ A, B], bar : [ 1, 2 ] }

record.compareTo($Object)

Parameters

parameter1

(Object)


record.compute($K, $BiFunction<? super K,? super V,? extends V>)

Parameters

parameter1
parameter2

(BiFunction<? super K,? super V,? extends V>)


record.computeIfAbsent($K, $Function<? super K,? extends V>)

Parameters

parameter1
parameter2

(Function<? super K,? extends V>)


record.computeIfPresent($K, $BiFunction<? super K,? super V,? extends V>)

Parameters

parameter1
parameter2

(BiFunction<? super K,? super V,? extends V>)


record.containsKey($Object)

Parameters

parameter1

(Object)


record.containsValue($Object)

Parameters

parameter1

(Object)


Record.create($entity)

Create a record from a Modelshop entity

Parameters

entity

(Map<String,Object>) The entity to copy to a record


Record.create($entity, $columns)

Create a record from a Modelshop entity with specific fields

Parameters

entity

(Map<String,Object>) The entity to copy to a record

columns

(List<String>) List of column names to include


Record.create()

Create a new empty record

Parameters

None


record.empty

Parameters

None


record.entrySet()

Parameters

None


record.forEach($BiConsumer<? super K,? super V>)

Parameters

parameter1

(BiConsumer<? super K,? super V>)


record.get($Object)

Parameters

parameter1

(Object)


record.getField($String)

Parameters

parameter1

(String)


record.getFieldError($String)

Parameters

parameter1

(String)


record.getOrDefault($Object, $V)

Parameters

parameter1

(Object)

parameter2

record.id

Parameters

None


record.key

Parameters

None


record.keyName

Parameters

None


record.keySet()

Parameters

None


Record.load($fileFormat, $filePath)

Read records from a source file (local to server)

Parameters

fileFormat

(String) CSV

filePath

(String) A file path local to the repository


record.merge($K, $V, $BiFunction<? super V,? super V,? extends V>)

Parameters

parameter1
parameter2
parameter3

(BiFunction<? super V,? super V,? extends V>)


record.put($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


record.put($String, $Object)

Parameters

parameter1

(String)

parameter2

(Object)


record.putAll($Map<String,?>)

Parameters

parameter1

(Map<String,?>)


record.putIfAbsent($K, $V)

Parameters

parameter1
parameter2

record.qualifiedSafeName

Parameters

None


record.recordType

Parameters

None


record.remove($Object)

Parameters

parameter1

(Object)


record.remove($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


record.replace($K, $V)

Parameters

parameter1
parameter2

record.replace($K, $V, $V)

Parameters

parameter1
parameter2
parameter3

record.replaceAll($BiFunction<? super K,? super V,? extends V>)

Parameters

parameter1

(BiFunction<? super K,? super V,? extends V>)


record.safeName

Parameters

None


record.setField($String, $Object)

Parameters

parameter1

(String)

parameter2

(Object)


record.size()

Parameters

None


record.values()

Parameters

None


Report

Utilities to export data in the form of files or reports


Report.clearReportLocation($location)

Clear the report location directory on the server CAUTION: will clear all reports in this destination

Parameters

location

(String) Absolute or folder location for export, lead with file: or http(s): for absolute (use / on Windows)


Report.closeAllExportViews($job)

Force the close of an export that was in append mode - not needed when not done as append

Parameters

job

(View) Job cursor returned from a exportView or exportViewJob


Report.closeExportView($job)

Force the close of an export that was in append mode - not needed when not done as append

Parameters

job

(Job) Job cursor returned from a exportView or exportViewJob


Report.exportMethodInfo()

Parameters

None


Report.exportView($view, $exportType, $location, $reportName, $viewFormat, $followEmbedded, $append, $entities)

Export a view to a file based report, wait until done)

Parameters

view

(View) View to export (use model.views.?)

exportType

(String) Format for export: json, xml or csv - for csv, optional :separator - e.g. csv:

location

(String) Absolute or folder location for export, lead with file: or http(s): for absolute (use / on Windows)

reportName

(String) Name of exported report (base name, no suffix)

viewFormat

(String) full, simple or none - full includes %, $, etc, none is fastest, full precision on floats

followEmbedded

(boolean) If true export embedded fields that are complex objects

append

(boolean) If true, append to existing file, otherwise replace existing

entities

(Collection<Entity>) list of entities to include, null for all


Report.exportViewJob($view, $exportType, $location, $reportName, $viewFormat, $followEmbedded, $append, $entities)

Export a view to a file based report, returns job handle (call job.wait() to wait)

Parameters

view

(Object) View to export (use model.views.?)

exportType

(String) Format for export: json, xml or csv - for csv, optional :separator - e.g. csv:

location

(String) Absolute or folder location for export, lead with file: or http(s): for absolute (use / on Windows)

reportName

(String) Name of exported report (base name, no suffix)

viewFormat

(String) full, simple or none - full includes %, $, etc, none is fastest, full precision on floats

followEmbedded

(boolean) If true export embedded fields that are complex objects

append

(boolean) If true, append to existing file, otherwise replace existing

entities

(Collection<Entity>) If not null, will only export these entities


Report.printView($View, $String, $Collection<Entity>)

Parameters

parameter1

(View)

parameter2

(String)

parameter3

(Collection<Entity>)


Report.printView($View, $String, $Entity)

Parameters

parameter1

(View)

parameter2

(String)

parameter3

(Entity)


Report.printView($view, $exportType)

Print a view and return as text

Parameters

view

(View) View to export (use model.views.?)

exportType

(String) Format for export: json, xml or csv


Report.refreshExportView($job, $entities)

Refresh prior view export with latest data - will be appended with current data if started with append

Parameters

job

(Job) Job cursor returned from a exportView or exportViewJob

entities

(Collection<Entity>) list of entities to include, null for all


Report.writeToFile($location, $fileName, $headers, $records, $append, $linefeeds)

Write data to a file

Parameters

location

(String) Absolute or folder location for export, lead with file: or http(s): for absolute (use / on Windows)

fileName

(String) Name file to write to

headers

(Collection<Object>) Collection of first rows of data (will not be repeated on append

records

(Collection<Object>) Collection of records to write to file

append

(Boolean) true to append if file exists, false to replace

linefeeds

(Boolean) true to include linefeeds between records


Rules

Utilities to manage rules and rulebases


Rules.codeFired($ruleCodePattern)

Return true if rule code has fired

Parameters

ruleCodePattern

(String) The code for the rule (supports regex)

Examples

Rules.codeFired('FOO_BAR_.*' == true for code 'FOO_BAR_RAE'

Rules.getRule($fullRuleName)

Get a rule info by full name

Parameters

fullRuleName

(String) Full name of rule in ‘Rulebase:Rule’ format


Rules.getRuleInfo($ruleId)

Return a a specific rules info based on a rule key (from the hierarchy)

Parameters

ruleId

(Object) A multikey or array in the form of [entityName, rulebaseName, ruleName]

Examples

Rules.getRuleInfo(['Emplyee','Overtime rules', 'Max hours worked']) = RuleInfo(Max Hours Worked)

Rules.getRulebase($rulebaseId)

Return a a specific rules info based on a rule key (from the hierarchy)

Parameters

rulebaseId

(Object) A multikey or array in the form of [entityName, rulebaseName]

Examples

Rules.getRuleInfo(['Emplyee','Overtime rules']) = Rulebase(Overtime rules)

Rules.getRules($rulebaseName)

Get a collection of all rule infos in the model

Parameters

rulebaseName

(String) The name of the rulebase to get rules for


Rules.hierarchy

Return a set of multikeys describing the rules hierarchy

Parameters

None

Examples

Rules.hierarchy = [[entity, rulebase, rule], [entity, rulebase, rule] ...]

Rules.rulebases

Get a collection of all rulebases objects in the model

Parameters

None


Rules.rules

Get a collection of all rule infos in the model

Parameters

None


Sample

Utilities to generate sample data


Sample.fillRandomDataset($datalistName, $recordCount, $deleteExisting)

Create and populate a random sample dataset based on data type and distribution instructions

Parameters

datalistName

(Object) Name of the datalist to populate - will fail if does not exists

recordCount

(Integer) number of records to create

deleteExisting

(Boolean) If true, delete existing records first


Scorecard


Scorecard.CATEGORY

Parameters

None


Scorecard.MAXIMUM

Parameters

None


Scorecard.MINIMUM

Parameters

None


Scorecard.WEIGHT

Parameters

None


scorecard.score($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


Scorecard.table($Collection)

Parameters

parameter1

(Collection)


Script

Utilities to manage the execution of scripts in the model


script.clear()

Parameters

None


script.compute($K, $BiFunction<? super K,? super V,? extends V>)

Parameters

parameter1
parameter2

(BiFunction<? super K,? super V,? extends V>)


script.computeIfAbsent($K, $Function<? super K,? extends V>)

Parameters

parameter1
parameter2

(Function<? super K,? extends V>)


script.computeIfPresent($K, $BiFunction<? super K,? super V,? extends V>)

Parameters

parameter1
parameter2

(BiFunction<? super K,? super V,? extends V>)


script.containsKey($Object)

Parameters

parameter1

(Object)


script.containsValue($Object)

Parameters

parameter1

(Object)


script.empty

Parameters

None


script.entrySet()

Parameters

None


script.forEach($BiConsumer<? super K,? super V>)

Parameters

parameter1

(BiConsumer<? super K,? super V>)


script.get($Object)

Parameters

parameter1

(Object)


script.getOrDefault($Object, $V)

Parameters

parameter1

(Object)

parameter2

script.keySet()

Parameters

None


script.merge($K, $V, $BiFunction<? super V,? super V,? extends V>)

Parameters

parameter1
parameter2
parameter3

(BiFunction<? super V,? super V,? extends V>)


Script.newScript($groovyScript)

Create and return a new dynamic script

Parameters

groovyScript

(String) The actual script content


script.put($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


script.put($String, $Script$ScriptRunner)

Parameters

parameter1

(String)

parameter2

(Script$ScriptRunner)


script.putAll($Map<String,Script$ScriptRunner>)

Parameters

parameter1

(Map<String,Script$ScriptRunner>)


script.putIfAbsent($K, $V)

Parameters

parameter1
parameter2

script.remove($Object)

Parameters

parameter1

(Object)


script.remove($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


script.replace($K, $V)

Parameters

parameter1
parameter2

script.replace($K, $V, $V)

Parameters

parameter1
parameter2
parameter3

script.replaceAll($BiFunction<? super K,? super V,? extends V>)

Parameters

parameter1

(BiFunction<? super K,? super V,? extends V>)


Script.runScript($script)

Run a dynamic script (script returned from newScript)

Parameters

script

(Script) A runtime script created by newScript


Script.runScript($script, $target)

Run a dynamic script for a given target object (script returned from newScript)

Parameters

script

(Script) A runtime script created by newScript

target

(Object) Target object to execute script on


Script.runScriptByName($scriptName)

Run a pre-configured script (configured in model)

Parameters

scriptName

(String) The name of a pre-configured script


Script.scripts

Get a list of registered scripts

Parameters

None


script.size()

Parameters

None


script.values()

Parameters

None


Security

User and security utilities


Security.userAuthority

Parameters

None


Security.userId

Parameters

None


Solver

Multiple solver implementations


Solver.knapsackMultiTarget($iterations, $items, $targetTotals)

Solve a multi-dimensional knapsack problem - meaning try to best fit totals in a given space

Parameters

iterations

(int) The maximum number of iterations to try - higher number should get more accurate results - millions ok

items

(Collection<Item>) A collection of items (i.e. entities) - can also be a collection of Records (required)

targetTotals

(Map<String,Number>) Map of name:value pairs for desired totals (sum) of target variables in results (required)


Solver.knapsackMultiTarget($iterations, $items, $targetTotals, $initialSolution, $minPick, $maxPick)

Solve a multi-dimensional knapsack problem - meaning try to best fit totals in a given space

Parameters

iterations

(int) The maximum number of iterations to try - higher number should get more accurate results - millions ok

items

(Collection<Item>) A collection of items (i.e. entities) - can also be a collection of Records (required)

targetTotals

(Map<String,Number>) Map of name:value pairs for desired totals (sum) of target variables in results (required)

initialSolution

(Map<String,Integer>) Map of key name:counts for starting items in result set (optional, default 0)

minPick

(Map<String,Integer>) Map of key name:counts for minimum allowed picks (optional, default 0)

maxPick

(Map<String,Integer>) Map of key name:counts for maximum allowed picks (optional, default unlimited)


Solver.solve($target, $controlField, $costField)

Solve to minimize a multi-variate cost function by changing multiple variables

Parameters

target

(Object) The entity to optimize

controlField

(Object) The field to vary during optimization - can be a string field name or a field expression

costField

(Object) The field that returns the cost value, the solver will attempt to minimize

Notes

the control field will be changed during the solver, but will be set back to the original value

Examples

Solver.solve(loan, loan.interestRate, loan.roi) -> 0.054523

Stats

Statistical analytic tools


Stats.binFixed($Number, $Number)

Parameters

parameter1

(Number)

parameter2

(Number)


Stats.correlation($collection 1, $collection 2)

Returns the correlation coefficient of two data sets

Parameters

collection 1

(Collection<Object>) set of values, can be collection or list of comma separated values

collection 2

(Collection<Object>) a second set of values

Notes

If the two sets are different sizes, the larger will be truncated

Examples

Stats.correlation([3, 2, 1],[5,4,3]) = 1.000

Stats.covariance($collection 1, $collection 2)

Returns the covariance, or average of the products of deviation for each data clusterPoint pair in two data sets

Parameters

collection 1

(Collection<Object>) set of values, can be collection or list of comma separated values

collection 2

(Collection<Object>) a second set of values

Notes

The two datasets must have the same number of values

Examples

Stats.covariance([7,2,10,18,4],[17,10,19,1,2]) = -11.700

Stats.darray($collection)

Provides an array of double numeric types composed of the specified values

Parameters

collection

(Collection<Object>) set of numeric values, can be collection or list of comma separated values


Stats.fillFieldStats($Vector, $FieldStats)

Parameters

parameter1

(Vector)

parameter2

(FieldStats)


Stats.getFieldStats($Vector)

Parameters

parameter1

(Vector)


Stats.histogram($collection)

Create a map that reflects simple histogram of a set of values

Parameters

collection

(Object) set of values - can be a collection or a comma separated list


Stats.max($collection)

Returns the largest of the set of values

Parameters

collection

(Collection<Object>) a set of values, can be collection or list of comma separated values

Examples

Stats.max([1,2,3,4]) = 4

Stats.mean($collection)

Returns the mean of a set of values

Parameters

collection

(Collection<Object>) a set of values, can be collection or list of comma separated values

Examples

Stats.mean([3,5,7]) = 5

Stats.median($collection)

Returns the median, or middle number, of the set of values

Parameters

collection

(Collection<Object>) a set of values, separated by commas, within brackets

Examples

Stats.median([0,26,100]) = 26

Stats.min($collection)

Returns the smallest of a set of values

Parameters

collection

(Collection<Object>) a set of values, can be collection or list of comma separated values

Examples

Stats.min([21,12.5,2]) = 2

Stats.percentRank($collection, $target)

Returns the ranking of a target value in the data set as a percentage

Parameters

collection

(Collection<Object>) a set of values, separated by commas, within brackets

target

(Object) the target value for which you want to know the ranking

Examples

Stats.percentRank([4,6,2,7,5],4) = 0.300

Stats.rank($values, $value)

Return the rank (position) of a value in a list of values - values will be sorted, zero based, rounds down

Parameters

values

(Object) A list of values, does not eed to be sorted

value

(Object) The value to rank

Examples

Stats.rank([10, 9, 8, 7, 6, 5, 4, 3, 2, 1], 6.5) -> 5

Stats.stddev($collection)

Calculates the standard deviation of a data set

Parameters

collection

(Collection<Object>) set of values, separated by commas, within brackets

Notes

Uses the “n-1” method of calculating standard deviation

Examples

Stats.stddev([38,13,31,40,10]) = 14.046

Stats.sum($collection)

Calculates the sum of the values in the data set

Parameters

collection

(Collection<Object>) set of values, can be collection or list of comma separated values

Examples

Stats.sum([10,12,50]) = 72.000

Stats.variance($collection)

Calculates the variance of a data set

Parameters

collection

(Collection<Object>) set of values, separated by commas, within brackets

Notes

Data set may include any boolean values, numbers in string format, and all number formats
TRUE arguments are interpreted as 1;FALSE arguments are interpreted as 0

Examples

Stats.Variance([true,3,5,7]) = 6.667

Stats.vector($collection)

Provides a new vector composed of the specified values

Parameters

collection

(Collection<Object>) set of numeric values, can be collection or list of comma separated values


Text

Tools for the manipulation of text strings


Text.ALPHAS

Parameters

None


Text.NUMBERS

Parameters

None


Text.REGEX_CREDITCARD

Parameters

None


Text.REGEX_DATE_SLASH

Parameters

None


Text.REGEX_DATE_YEARFIRST

Parameters

None


Text.REGEX_EMAIL

Parameters

None


Text.REGEX_USCURRENCY

Parameters

None


Text.REGEX_UUID

Parameters

None


Text.SYMBOLS

Parameters

None


Text.capitalCamelCase($String)

Convert a CAPITAL_CAMEL_CASE value to CapitalCamelCase

Parameters

parameter1

(String)

Notes

My fair lady -> MyFairLady MY_FAIR_LADY -> MyFairLady

Text.capitalUnderscore($String)

Convert a CapitalUnderscore to CAPITAL_UNDERSCORE

Parameters

parameter1

(String)

Notes

MyFairLady -> MY_FAIR_LADY

Text.capitalize($text)

Capitalize the provided text

Parameters

text

(String) provided text


Text.contains($target, $compareList)

Return true if the target string contains the compare string

Parameters

target

(String) The string to compare

compareList

(String) A string to search for


Text.containsAny($target, $compareList)

Return true if any of strings found in source

Parameters

target

(String) The string to compare

compareList

(String[]) A comma separated list of strings to use for comparison

Examples

Text.containsAny('foo', 'aaa', 'foo', 'bbb') -> true

Text.containsAnyChar($target, $compareChars)

Return true if any characters found in source

Parameters

target

(String) The string to compare

compareChars

(String) A string with multiple characters to test

Examples

containsAnyChar('foobar', 'obs') -> true

Text.containsAnyCharNoCase($target, $compareChars)

Return true if any characters from string found in source (case insensitive)

Parameters

target

(String) The string to compare

compareChars

(String) A list of strings to use for comparison


Text.containsAnyNoCase($target, $compareList)

Return true if any of strings found in source (case insensitive)

Parameters

target

(String) The string to compare

compareList

(String[]) A comma separated list of strings to use for comparison

Examples

Text.containsAny('FOO', 'aaa', 'foo', 'bbb') -> true

Text.containsNoCase($target, $compare)

Return true if target contains the string compare (case insensitive)

Parameters

target

(String) The string to compare

compare

(String) the string to use for comparison


Text.countString($String, $String)

Parameters

parameter1

(String)

parameter2

(String)


Text.decrypt($String)

Parameters

parameter1

(String)


Text.empty($String)

Parameters

parameter1

(String)


Text.encrypt($Object)

Parameters

parameter1

(Object)


Text.equalOrNull($String, $String)

Parameters

parameter1

(String)

parameter2

(String)


Text.equalsNoCase($a, $b)

Compare values ignoring case, returns boolean true if equal

Parameters

a

(String) text a

b

(String) text b


Text.extractAll($source, $regex)

Extract all occurances of a regular expression, returns an ordered list

Parameters

source

(String) The source string for extraction

regex

(String) Regular expression for extraction

Notes

use standard Text.REGEX_* patterns or create custom patterns - learn more: https://regexr.com/

Text.extractGroups($source, $regex)

Return all groups identified in a regex expression

Parameters

source

(String) The source string for extraction

regex

(String) Regular expression for extraction

Notes

use standard Text.REGEX_* patterns or create custom patterns - learn more: https://regexr.com/

Examples

Text.extractGroups('Please transfer $1,000 from my savings account to my checking account', '(transfer)(.{1,})(from)(.{1,})(to)(.{1,})$') = ['transfer', '$1,000', 'from', 'my savings account', 'to', 'my checking account']

Text.findByToken($String, $String, $int)

Parameters

parameter1

(String)

parameter2

(String)

parameter3

(int)


Text.format($object, $format)

Format an object from string

Parameters

object

(Object) The object data to format

format

(String) The format to use

Notes

Examples

Text.format(1034.2, '\$#,###.00') -> $1,034.20

Text.fromBase36($base36)

Convert a base36 string back to the seed string

Parameters

base36

(String) A base 36 string


Text.fromJson($String)

Parameters

parameter1

(String)


Text.fromJson($String, $Class)

Parameters

parameter1

(String)

parameter2

(Class)


Text.fromXml($xml)

Convert XML into a target type

Parameters

xml

(String) The XML to convert to an object

Notes

JAXBContext is borrowed from any RAWS fields or connectors in this model, otherwise provide using alternate function

Text.fromXml($xml, $jaxbContext)

Convert XML into a target type

Parameters

xml

(String) The XML to convert to an object

jaxbContext

(String) List of paths to ObjectFactories, separated by a colon :

Notes

JAXBContext is borrowed from any RAWS fields or connectors in this model, otherwise provide here

Text.fromXmlTag($Object, $String)

Parameters

parameter1

(Object)

parameter2

(String)


Text.fuzzyMatch($target, $compareList)

Return the value that has the highest fuzzy score

Parameters

target

(Object) The string to compare

compareList

(Object) List of strings to compare to

Notes

returns the string value that closest matches target

Text.fuzzyMatch($target, $compareList, $scoreMin)

Return the extracted result that has the highest fuzzy score

Parameters

target

(Object) The string to compare

compareList

(Object) List of strings to compare to

scoreMin

(Object) Minimum score to match scale (0-100, 95+ reasonable confidence)

Notes

ExtractedResult has the following attributes: string, score, index

Text.fuzzyScore($target, $compare)

Return a fuzzy match score between two strings - 100 is perfect match

Parameters

target

(Object) The string to compare

compare

(Object) the string to use for comparison


Text.isAllCaps($String)

Parameters

parameter1

(String)


Text.isUuid($seed)

Create a consistent uuid value from a seed string

Parameters

seed

(Object) A string seed for the uuid


Text.join($textArray[], $joinBy)

Join string with delimiting character

Parameters

textArray[]

(Collection<Object>) array of text to join

joinBy

(String) the text to use to do the join


Text.json($Object)

Parameters

parameter1

(Object)


Text.jsonPretty($Object)

Parameters

parameter1

(Object)


Text.leaf($value, $delimiter)

Find the leaf part of a string based on a token delimiter

Parameters

value

(String) A string to find leaf on

delimiter

(String) The character or characters to split string

Examples

Text.leaf('Foo.Bar', '.') -> 'Bar'

Text.left($String, $int)

Parameters

parameter1

(String)

parameter2

(int)


Text.matchRegEx($source, $regex)

Validate that text conforms to a regular expression format

Parameters

source

(String) The source string for validation

regex

(String) Regular expression for validation

Notes

use standard Text.REGEX_* patterns or create custom patterns - learn more: https://regexr.com/

Text.output($Object)

Parameters

parameter1

(Object)


Text.output($Object, $String)

Parameters

parameter1

(Object)

parameter2

(String)


Text.pad($Object, $Object)

Parameters

parameter1

(Object)

parameter2

(Object)


Text.pathLeaf($String)

Parameters

parameter1

(String)


Text.randomString($int)

Parameters

parameter1

(int)


Text.randomString($int, $String)

Parameters

parameter1

(int)

parameter2

(String)


Text.removeAll($value, $strip)

Create a consistent uuid value from a seed string

Parameters

value

(String) A string to remove characters from

strip

(String) One or more caracters to strip from string


Text.replace($original, $replace, $with)

Replace a string segment with another

Parameters

original

(Object) original string

replace

(Object) value in string to replace

with

(Object) value to replace it with

Examples

Text.replace('the brown fox is brown', 'brown', 'red') -> 'the red fox is red'

Text.right($String, $int)

Parameters

parameter1

(String)

parameter2

(int)


Text.split($text, $splitChars)

Split string into tokens by any of the delimiters included in the splitBy string - returns a list of strings

Parameters

text

(String) the text to split

splitChars

(String) a list of characters to use to do the split


Text.splitRegEx($text, $regEx)

Split string into tokens by the regular expression - returns a list of strings

Parameters

text

(String) the text to split

regEx

(String) regular expression to use to do the split

Notes

Uses regular expressions - you must escape characters that are regex sensitive. See: https://www.regular-expressions.info/tutorial.html

Text.splitString($text, $splitChars)

Split string into tokens by any of the delimiters included in the splitBy string - returns a list of strings

Parameters

text

(String) the text to split

splitChars

(String) a string that combined causes the split


Text.splitWithQuotes($text, $splitChars, $quoteChars)

Split string into tokens by any of the delimiters included in the splitBy string, ignoring any delimiters inside quotes identified by quoteChars- returns a list of strings

Parameters

text

(String) the text to split

splitChars

(String) a list of characters to use to do the split

quoteChars

(String) a list of characters that act as quotes or other grouping


Text.stripJustLower($String)

Parameters

parameter1

(String)


Text.template($template)

Convert a templated string to a final string using the current object as the source

Parameters

template

(String) A string that has template substitutions in the form ${expression}

Notes

Examples

Text.template("The quick ${color} jumped over the ${effort < 7 ? 'lazy' : 'not so lazy'} dog")

Text.template($template, $object)

Convert a templated string to a final string using the given object as the source

Parameters

template

(String) A string that has template substitutions in the form ${expression}

object

(Object) Source for calculations in template

Notes

Examples

Text.template("The quick ${color} jumped over the ${effort < 7 ? 'lazy' : 'not so lazy'} dog", the Object)

Text.text($Object)

Parameters

parameter1

(Object)


Text.toBase36($source)

Create a base36 string from a given seed string (alphanumeric)

Parameters

source

(String) The string to seed the base36


Text.trim($String)

Parameters

parameter1

(String)


Text.trimLeft($String)

Parameters

parameter1

(String)


Text.trimLines($String)

Parameters

parameter1

(String)


Text.trimRight($String)

Parameters

parameter1

(String)


Text.uncapitalize($text)

Uncapitalize the provided text

Parameters

text

(String) provided text


Text.uuid($seed)

Create a consistent uuid value from a seed string

Parameters

seed

(Object) A string seed for the uuid


Text.uuid()

Create a uuid random value

Parameters

None


Text.xml($target)

Return the XML representation of an object

Parameters

target

(Object) The object you want to convert to XML


Timeseries

Tools for the time-series analysis


Timeseries.BUSINESSDAY

Parameters

None


Timeseries.DAY

Parameters

None


Timeseries.HOUR

Parameters

None


Timeseries.MILLISECOND

Parameters

None


Timeseries.MINUTE

Parameters

None


Timeseries.MONTH

Parameters

None


Timeseries.SECOND

Parameters

None


Timeseries.YEAR

Parameters

None


Timeseries.intervals($dateSeries, $interval)

Return an array of interval length between each date

Parameters

dateSeries

(Object) Collection of ordered dates

interval

(int) An integer value representing interval, e.g. Timeseries.DAY see notes

Notes

Interval types are Timeseries.YEAR, MONTH, DAY, BUSINESSDAY, HOUR, MINUTE, SECOND, MILLISECOND

Examples

Timeseries.intervals('2020-01-05', '2020-01-10', '2020-01-12') -> [5, 2]

Timeseries.intervalsBusinessDays($dateSeries)

Return an array of business days between each date (see intervals help)

Parameters

dateSeries

(Object) Collection of ordered dates


Timeseries.intervalsDays($dateSeries)

Return an array of days between each date (see intervals help)

Parameters

dateSeries

(Object) Collection of ordered dates


Timeseries.intervalsHours($dateSeries)

Return an array of hours between each date (see intervals help)

Parameters

dateSeries

(Object) Collection of ordered dates


Timeseries.intervalsMillisec($dateSeries)

Return an array of milliseconds between each date (see intervals help)

Parameters

dateSeries

(Object) Collection of ordered dates


Timeseries.intervalsMinutes($dateSeries)

Return an array of minutes between each date (see intervals help)

Parameters

dateSeries

(Object) Collection of ordered dates


Timeseries.intervalsMonths($dateSeries)

Return an array of months between each date (see intervals help)

Parameters

dateSeries

(Object) Collection of ordered dates


Timeseries.intervalsSeconds($dateSeries)

Return an array of seconds between each date (see intervals help)

Parameters

dateSeries

(Object) Collection of ordered dates


Timeseries.intervalsYears($dateSeries)

Return an array of years between each date (see intervals help)

Parameters

dateSeries

(Object) Collection of ordered dates


Utility

Miscellaneous utilities


utility.context

Parameters

None


utility.sequence($String)

Parameters

parameter1

(String)


Utility.sleep($long)

Parameters

parameter1

(long)


Utility.timer()

Parameters

None


Vector

Support for vectors of data


vector.addValue($double)

Parameters

parameter1

(double)


vector.apply($UnivariateStatistic)

Parameters

parameter1

(UnivariateStatistic)


Vector.averageV($values…)

Provide an average of each position in a vector - treat missing as non-averaged

Parameters

values…

(Object[]) An list of arrays of objects

Examples

Vector.averageV([1,2,3],[4,5,6]) == [2.5,3.5,4.5]

vector.clear()

Parameters

None


Vector.copy($DescriptiveStatistics, $DescriptiveStatistics)

Parameters

parameter1

(DescriptiveStatistics)

parameter2

(DescriptiveStatistics)


vector.copy()

Parameters

None


Vector.create($values)

Create a vector that contains the specified values

Parameters

values

(Collection<Object>) A collection of objects to be deposited in the vector


Vector.deltaPercentV($values)

Convert vector to delta percent change between each value and first value

Parameters

values

(Object) An array of objects

Examples

Vector.deltaPercentV([10,12,17,25,30,40]) == [0,0.2,0.7,1.5,2,3]

Vector.deltaV($values)

Convert vector to delta change between each value

Parameters

values

(Object) An array of objects

Examples

Vector.deltaV([10,12,17,25,30,40]) == [0,2,5,8,5,10]

Vector.describe($values)

Create a vector that contains the specified values

Parameters

values

(Collection<Object>) A collection of objects to be deposited in the vector


Vector.exponentialMovingAverage($values)

Provide the exponential moving average of the specified values

Parameters

values

(Object[]) An array of objects whose exponential moving average is requested


Vector.exponentialMovingAverage($values, $from, $to)

Provide the exponential moving average of a subset of the specified values

Parameters

values

(Object[]) An array of objects whose exponential moving average is requested

from

(int) The index in the array where the algorithm starts

to

(int) The index where the algorithm finishes


vector.geometricMean

Parameters

None


vector.geometricMeanImpl

Parameters

None


vector.getElement($int)

Parameters

parameter1

(int)


vector.getPercentile($double)

Parameters

parameter1

(double)


vector.kurtosis

Parameters

None


vector.kurtosisImpl

Parameters

None


vector.max

Parameters

None


vector.maxImpl

Parameters

None


vector.mean

Parameters

None


Vector.mean($values)

Provide the mean of the specified values

Parameters

values

(Collection<Object>) A collection of objects whose mean is requested


Vector.mean($values, $from, $to)

Provide the mean of a subset of the specified values

Parameters

values

(Object[]) An array of objects whose mean is requested

from

(int) The index in the array where the algorithm starts

to

(int) The index where the algorithm finishes


vector.meanImpl

Parameters

None


vector.median

Provide the median of the values stored in the vector

Parameters

None


Vector.median($values)

Provide the median of the specified values

Parameters

values

(Object) A collection of objects whose median is requested


vector.min

Parameters

None


vector.minImpl

Parameters

None


Vector.multiplyV($values, $multiplier)

Multiply a vector by a scalar or another vector

Parameters

values

(Object) An array of objects

multiplier

(Object) Value to multiply each entry by

Examples

Vector.multiplyV([1,2,3,4,5,6], 10) == [10,20,30,40,50,60]

vector.n

Parameters

None


vector.percentileImpl

Parameters

None


vector.populationVariance

Parameters

None


vector.quadraticMean

Parameters

None


Vector.rank($value, $values)

Return ranked position in vector

Parameters

value

(Comparable) The value to rank

values

(Object) An array of objects

Examples

Vector.rank(18, [10,12,17,25,30,40]) == 4

vector.removeMostRecentValue()

Parameters

None


vector.replaceMostRecentValue($double)

Parameters

parameter1

(double)


vector.skewness

Parameters

None


vector.skewnessImpl

Parameters

None


Vector.slice($Collection<Item>, $String)

Parameters

parameter1

(Collection<Item>)

parameter2

(String)


Vector.slope($values)

Provide the sope of the specified values

Parameters

values

(Object[]) An array of objects whose slope is requested


Vector.slope($values, $from, $to)

Provide the slope of a subset of the specified values

Parameters

values

(Object[]) An array of objects whose slope is requested

from

(int) The index in the array where the algorithm starts

to

(int) The index where the algorithm finishes


vector.sortedValues

Parameters

None


vector.standardDeviation

Parameters

None


Vector.standardDeviation($values)

Provide the standard deviation of the specified values

Parameters

values

(Object[]) An array of objects whose standard deviation is requested


Vector.standardDeviation($values, $from, $to)

Provide the standard deviation of a subset of the specified values

Parameters

values

(Object[]) An array of objects whose standard deviation is requested

from

(int) The index in the array where the algorithm starts

to

(int) The index where the algorithm finishes


vector.sum

Parameters

None


Vector.sum($values)

Provide the sum of the specified values

Parameters

values

(Object[]) An array of objects whose sum is requested


Vector.sum($values, $from, $to)

Provide the sum of a subset of the specified values

Parameters

values

(Object[]) An array of objects whose sum is requested

from

(int) The index in the array where the algorithm starts

to

(int) The index where the algorithm finishes


Vector.sumIf($compare, $lookup, $values)

Conditionally sum values in a list

Parameters

compare

(Comparable) The value to compare to lookup

lookup

(Object) He list of lookup values to compare

values

(Object) The values to sum

Examples

Vector.sumIf('foo', ['bar', 'foo', 'foo', 'a', 'b', 'foo'], [10,12,17,25,30,40]) == 69

vector.sumImpl

Parameters

None


Vector.sumProduct($values1, $values2)

Provide the sum of the products of the values specified in a pair of vectors

Parameters

values1

(Object[]) An array of objects

values2

(Object[]) Another array of objects

Notes

The vectors must be of the same size.

Examples

sumProduct([1,2,3],[4,5,6]) == 32
sumProduct([9,0,8],[4,5,6]) == 64

Vector.sumProduct($values1, $values2, $from, $to)

Provide the sum of the products of a subset of the values specified in a pair of vectors. The vectors must be of the same size.

Parameters

values1

(Object[]) An array of objects

values2

(Object[]) Another array of objects

from

(int) The index in the arrays where the algorithm starts

to

(int) The index where the algorithm finishes


Vector.sumV($values…)

Provide a sum of each position in a vector - treat missing as zero

Parameters

values…

(Object[]) An list of arrays of objects

Examples

Vector.sumV([1,2,3],[4,5,6]) == [5,7,9]

vector.sumsq

Parameters

None


vector.sumsqImpl

Parameters

None


vector.values

Parameters

None


vector.variance

Parameters

None


vector.varianceImpl

Parameters

None


vector.windowSize

Parameters

None


vector.zScore($value)

Provide the z-score or standard score of the specified value

Parameters

value

(Number) The numeric value whose z-score is requested


Version

Versioning info for Modelshop and the model


Version.manifest

Parameters

None


Version.manifest($String)

Parameters

parameter1

(String)


Version.modelConfigVersion

Parameters

None


Version.modelUUID

Parameters

None


Version.modelVersion

Parameters

None


Version.modelshopVersion

Parameters

None


View

Tools to manipulate and return views


view.addExportJob($Job)

Parameters

parameter1

(Job)


view.exportJobs

Parameters

None


view.getColumnValues($String, $List<AbstractMap$SimpleEntry<String,String>>)

Parameters

parameter1

(String)

parameter2

(List<AbstractMap$SimpleEntry<String,String>>)


view.getEntities($long)

Parameters

parameter1

(long)


view.getRecords($String)

Parameters

parameter1

(String)


view.getUnformattedColumnValues($int, $String, $String, $int)

Parameters

parameter1

(int)

parameter2

(String)

parameter3

(String)

parameter4

(int)


view.name

Parameters

None


view.records

Return a list of data records from view

Parameters

None


view.removeExportJob($Job)

Parameters

parameter1

(Job)


view.view

Parameters

None


View.views

Parameters

None


WebScrape

Web scraping tools


webScrape.listTables()

Parameters

None


webScrape.loadTable($String)

Parameters

parameter1

(String)


webScrape.page

Parameters

None


webScrape.rows

Parameters

None


webScrape.title

Parameters

None


WebService

Web service integration tools


WebService.APPLICATION_JSON

Parameters

None


WebService.APPLICATION_XML

Parameters

None


WebService.TEXT_HTML

Parameters

None


WebService.TEXT_PLAIN

Parameters

None


WebService.TEXT_XML

Parameters

None


WebService.get($url)

GET from a given URL using REST, will return a Json object

Parameters

url

(String) the web service url

Examples

WebService.get('https://app.modelshop.com/ping/ping') -> 'PONG'

WebService.get($url, $params)

GET from a given URL using REST, will return a string

Parameters

url

(String) the web service url

params

(Object) query parameters, can be entity, map or json string

Examples

WebService.post()

WebService.get($url, $params, $returnType)

GET from a given URL using REST, will return an object of type returnType

Parameters

url

(String) the web service url

params

(Object) query parameters, can be entity, map or json string

returnType

(Object) Object type that will be returned, can be a class, an example object or text full class name

Examples

WebService.post()

WebService.post($url, $params, $returnType, $payload)

POST to a given URL using REST, will return an object

Parameters

url

(String) the web service url

params

(Object) query parameters, can be entity, map or json string

returnType

(Object) Object type that will be returned, can be a class, an example object or text full class name (leave blank for Map)

payload

(Object) an object that will be sent

Examples

WebService.post()

Window

Utilities to evaluate windows of data (e.g. time series)


window.add($Object)

Parameters

parameter1

(Object)


window.add($int, $Object)

Parameters

parameter1

(int)

parameter2

(Object)


window.addAll($Collection<?>)

Parameters

parameter1

(Collection<?>)


window.addAll($int, $Collection<?>)

Parameters

parameter1

(int)

parameter2

(Collection<?>)


Window.average($Average, $Number)

Parameters

parameter1

(Average)

parameter2

(Number)


Window.average($Average, $Number, $int)

Parameters

parameter1

(Average)

parameter2

(Number)

parameter3

(int)


window.average{it.$field}

Parameters

None


window.clear()

Parameters

None


window.collectBig{it.$field}

Parameters

None


window.collect{it.$field}

Parameters

None


window.contains($Object)

Parameters

parameter1

(Object)


window.containsAll($Collection<?>)

Parameters

parameter1

(Collection<?>)


window.count{it.$field}

Parameters

None


window.each{it.$field}

Parameters

None


window.empty

Parameters

None


window.findAllBig{it.$field}

Parameters

None


window.findAll{it.$field}

Parameters

None


window.findIndexOf{it.$field}

Parameters

None


window.find{it.$field}

Parameters

None


window.first()

Parameters

None


window.forEach($Consumer<? super T>)

Parameters

parameter1

(Consumer<? super T>)


window.get($int)

Parameters

parameter1

(int)


window.getAt($String)

Parameters

String

(null)


window.getAt($int)

Parameters

int

(null)


window.indexOf($Object)

Parameters

parameter1

(Object)


window.iterator()

Parameters

None


window.last()

Parameters

None


window.lastIndexOf($Object)

Parameters

parameter1

(Object)


Window.leading($Entity, $int, $String)

Parameters

parameter1

(Entity)

parameter2

(int)

parameter3

(String)


window.listIterator($int)

Parameters

parameter1

(int)


window.listIterator()

Parameters

None


window.max{it.$field}

Parameters

None


window.min{it.$field}

Parameters

None


window.parallelStream()

Parameters

None


window.remove($Object)

Parameters

parameter1

(Object)


window.remove($int)

Parameters

parameter1

(int)


window.removeAll($Collection<?>)

Parameters

parameter1

(Collection<?>)


window.removeIf($Predicate<? super E>)

Parameters

parameter1

(Predicate<? super E>)


window.replaceAll($UnaryOperator<E>)

Parameters

parameter1

(UnaryOperator<E>)


window.retainAll($Collection<?>)

Parameters

parameter1

(Collection<?>)


window.set($int, $Object)

Parameters

parameter1

(int)

parameter2

(Object)


window.size()

Parameters

None


window.sort($Comparator<? super E>)

Parameters

parameter1

(Comparator<? super E>)


window.sort{it.$field}

Parameters

None


window.spliterator()

Parameters

None


Window.standardDeviation($StandardDeviation, $Number)

Parameters

parameter1

(StandardDeviation)

parameter2

(Number)


Window.standardDeviation($StandardDeviation, $Number, $int)

Parameters

parameter1

(StandardDeviation)

parameter2

(Number)

parameter3

(int)


window.stream()

Parameters

None


window.subList($int, $int)

Parameters

parameter1

(int)

parameter2

(int)


Window.sum($Sum, $Number)

Parameters

parameter1

(Sum)

parameter2

(Number)


Window.sum($Sum, $Number, $int)

Parameters

parameter1

(Sum)

parameter2

(Number)

parameter3

(int)


window.sumBig{it.$field}

Parameters

None


window.sum{it.$field}

Parameters

None


window.take($int)

Parameters

int

(null)


window.toArray($IntFunction<T[]>)

Parameters

parameter1

(IntFunction<T[]>)


window.toArray($T[])

Parameters

parameter1

(T[])


window.toArray()

Parameters

None