Carrot reference

Functions

Functions in ChartHop work just like functions in spreadsheets -- they perform calculations on particular data (passed in as parameters) and return a return value. Some functions also retrieve data from the ChartHop database.

Syntax

A function in Carrot appears as the function name followed by parentheses, which accepts one or several parameter values.

function(parameter1, [parameter2])

All function names are case-insensitive.

Usage

Functions can be used in any Carrot expression, anywhere Carrot is used (in Smart Calc or Smart Bucket field types, when filtering the Data Sheet, configuring charts within Dashboards, building out custom content for the Homepage or Profiles, etc.)

Function list

Function

Description

abs()

Returns the absolute value of a given value.

asOf()

Returns the result of a Carrot expression on a particular date using either only Primary data, or both Primary and Scenario based data.

boolean()

Converts supported datatypes into a Boolean, equal to either true or false.

Returns the value of base or variable compensation on a given date.

Calculates the base, variable or cash compensation of a person over a specified period of time including all jobs the person has held.

Calculates the cost of a job over a specified period of time where the cost of a job includes if multiple people have held that job.

date()

Converts input to Date including relative Date input.

day()

Returns the day of the month of a particular date.

Returns the number of days off taken between two given dates.

Returns the total number of years between two given dates.

Returns the total number of months between two given dates.

Returns the distance between built-in addresses in ChartHop in the specified units.

Returns the last day of a given month.

Converts a given value of type Money into a String, while retaining the currency type in the String output. Optionally specify the format and locale of the returned value.

Converts a given value into a String, rounded to specific decimal place. Accepts Number, Money, or Percent datatypes.

Converts a given value of type Number into a String.

Converts a given value of type Percent into a String.

Converts a given value of type Date into a String.

Returns all of the shares that were granted between two specified dates.

length()

Returns the number of items in a list or set, or the length of a String.

max()

Returns the highest of all values passed as parameters.

mean()

Returns the mean value of all the passed parameters, excluding Nulls.

money()

Converts a given value to datatype Money, including currency conversion.

month()

Returns the ordinal number of the month of a particular date, from 1-12, where 1 is January, 2 is February, and so on.

min()

Returns the lowest of all values passed as parameters.

Given a date, returns the next upcoming anniversary of that date.

number()

Given a value, returns that value as a Number.

Given a value of type String, returns that value in plural form.

percent()

Given a value, returns that value as a Percent.

random()

Returns a random Number between 0 and 1.

round()

Rounds a given value to the defined number of decimal places.

roundUp()

Rounds a given value to the next largest integer.

Rounds a given value to the next smallest number.

string()

Given a value, returns that value as a String.

Given a String and specified parameters, returns a part of that String.

Given a Date, returns the value of shares on that date.

Returns the first day of a given month.

split()

Divides a String into a list of Strings.

Given a start date and end date, returns the share price value of stock that will vest over that period of time.

Given a start date and end date, returns the number of shares that will vest over that period of time.

year()

Returns the Gregorian calendar year of a particular date.



Updated 20 Dec 2023
Doc contributor
Did this page help you?