14min

Getting started with Carrot

Carrot is a fast and powerful way to find the information you're looking for.

We built Carrot to help you search your organization, and build powerful reports, simply and quickly, without having to learn complex SQL or needing to know how to program. If you've ever used filters in Gmail, or formulas in Excel, you should be right at home.

You can use Carrot everywhere in ChartHop, including the Org chart, Data sheet, Map, Reports, Custom fields, and app configurations.

Document image

Figure 1: Carrot in use on the Data Sheet

Under the surface, Carrot is a powerful query engine with many advanced features like Carrot Templates and Reports, but it's easy to get started and you don't need to know everything to be productive.

Carrot examples

The below examples illustrate how you might use Carrot when creating filters, queries, custom fields, etc.

Example

Searches for

title:director

everyone with "director" somewhere in their title

title="Director of Engineering"

the exact title "Director of Engineering"

startDate<'2020-01-01'

everyone who started before Jan 1 2020 

is:manager

all people managers

!department:sales,marketing

everyone who is not in the Sales or Marketing departments

is:open daysOpen>90

open jobs that have been open for more than 90 days

For more advanced queries, Carrot can do math, compute functions, or access structured data, as illustrated below.

Example

Searches for

is:open (base+variable)>150000

open jobs with base plus variable compensation over $150,000

vestedShares(today,date('+1y'))>1000

people who vest more than 1000 shares in the next year

grants[0].shares

the per-share price of someone's first equity grant

Here are a few key things to remember about Carrot:

  • You can access all built-in ChartHop fields, as well as any custom fields you've created.
  • All fields and functions are case-insensitive.
  • Carrot operators understand money-math and will automatically convert currencies when adding or subtracting two different currencies.
  • Carrot always evaluates everything relative to the date being viewed. That date is accessible as the date field. If you need today's date, you can get it from today.
  • All data access is permission controlled, according to ChartHop Access Levels, so two different users running a query may get different results if they have different permissions.
  • Carrot understands many common data types, including standard data types like Number and String, as well as ChartHop-specific types like Money and Comp.

Truthiness

As you explore the various functions, fields, and operators available to you in Carrot, you will undoubtedly run into an expression that relies on an understanding of truthiness. Gaining familiarity with this concept will be instrumental as you dive deeper into the functionality of Carrot.

Consider the ? (ternary) operator used in the prorated base salary expression below.

base * (tenure < 12 ? tenure / 12 : 1)

Here we are using the properties of the ternary (?) operator to evaluate the truthiness of the expression tenure < 12 in order to determine whether Carrot should return the prorated value of base. or the full value of base.

In this case, if the statement tenure < 12 is found to be truthy, Carrot will return the prorated value of base. If the statement is found to be non-truthy, Carrot will return the full value of base.

In the above example, if the value of tenure is 11 or less, then the statement tenure < 12 is considered to be truthy. If the value of tenure is 12 or greater, then the statement tenure < 12 is considered to be non-truthy.

Expressions that are non-truthy can have the following values:

  • Null (See Null)
  • false
  • 0 and equivalent numeric values (including money(0) and percent(0))
  • "" and equivalent empty strings
  • [] and equivalent empty lists
  • {} and equivalent empty objects

Expressions with any other value are considered to be truthy.

Additional resources

You can use the Carrot glossary to find information on operators, data types, aggregators, and functions. Fields are also documented under "Fields."

You can use the Operator precedence page to learn about which operators are evaluated first when Carrot evaluates an expression.



Updated 07 Dec 2021
Did this page help you?
Yes
No