Carrot reference

Key Concepts

To create a Carrot query, it helps to have a basic understanding of fields, operators, values, functions, and methods. You can learn more about these key concepts below.

Fields

A field in Carrot is a word that represents a built-in field or a custom field that has already been defined in ChartHop. All fields are case-insensitive.

A field contains a reference to specific job, employee and organization data, allowing operations to be ran on it in order to perform calculations. For example:

Text


The workAddressfield can be used as a reference to an employee's work address found in their employee profile.

Fields may also posses properties which are unique members of data belonging to the field's particular data type. For example:

Text


city is a property of the workAddress field and has the value of "Oak Park".

Operators

An operator in Carrot is one or more symbols or words that compare the value of a field on its left with one or more values (or functions) on its right. The valuation of the clause will always result as true. For example:

Text


This query uses the * (multiply) operator to evaluate the basic mathematical statement.

Text


This query returns all records where department is engineering.

Carrot operators understand "money math" and will automatically convert currencies when adding or subtracting two different currencies.

Keywords

A keyword in Carrot is a word or phrase that:

  • Joins two or more clauses together to form a complex Carrot query.
    • directs>0 && department:engineering
  • Alters the logic of one or more clauses.
    • directs>0 && !department:accounting
  • Alters the logic of operators.
    • department!="engineering"
  • Has an explicit definition in a Carrot query
    • department:engineering where: means"matches"
    • workAddress.city:"Oak Park" where . refers to the property city of the field work address field
  • Performs a specific function that alters the results of a Carrot query.
    • tenure <= 3

Carrot contains a limited number of reserved keywords.

Functions

A function in Carrot appears as a word followed by parentheses, which may contain one or more explicit values or Carrot fields. All functions are case-insensitive.

A function performs a calculation on specific Carrot data or on the function's content (enclosed within its parentheses), such that the results retrieved by the function return as true, and then again by the clause in which the function is used. For example:

Text


This query will return the base compensation of a person between the dates of January 7th, 2017 and January 8th, 2022.

Methods

Methods are special types of Functions that apply to a List or Sequence of data. Usually, methods are used to aggregate data – such as counting or summing List values.

For example, to count x

Aggregators (Deprecated)

Aggregators were formally used in ChartHop Dashboards. However, they are now deprecated and should be replaced with their corresponding Method.

An aggregator in Carrot appears as a word followed by curly brackets, which contains an expression. All aggregators are case-insensitive.

An aggregator performs a calculation on an expression and returns a Number value based on the aggregator's logic. For example:

Text


This query will return the total number of jobs in the engineering department in the ChartHop organization. All non-numeric values are discarded.

Data types

Carrot understands many common data types, including standard data types such as Number and String, as well as a number of ChartHop-specific data types such as Money and Comp.

Reserved characters

Carrot has a list of reserved characters:

space (' ') - + = . : ? | * / % [ ]

These characters are reserved for use in operations and keywords. If you wish to use these characters in queries, you need to surround them with quote-marks. You can use either single quote-marks ' or double quote-marks ".

For example:

Text


Search for special characters in text fields is limited.