Call 1-(720)-316-8174

# Scripting Concepts

Overview

Easy Insight uses its own simple scripting language for custom fields, conditional formatting, and advanced report customization. We've tried to keep it as similar to other standard scripting languages as possible.

You'll reference your fields in the various calculations surrounded by brackets, so to reference your Revenue field, you would do [Revenue] in your calculation.

Functions are what you'll use to perform different logic around your fields. To use a function, you start by adding the function name to the calculation. You'll then need to add a number of parameters to the function, surrounded by parantheses. For example, you can make a text value all upper case by doing upper([text field]). Even if the function doesn't take any parameters, you'll still need to put in an empty set of parantheses--for example, nowdate().

## Common Calculation Examples

Calculating a Percentage
``[Measure1] / [Measure2] * 100``
Parse a Date from a Text Field
``parsedate([date field], "yyyy-MM-dd")``
Format a Text Date from a Date Field
``dateformat([date field], "yyyy-MM-dd")``
First Three Characters of a Grouping
``substring([Grouping], 0, 3)``
If Grouping contains a dash, use AlternateGrouping, otherwise use Grouping.
``if(indexof([Grouping], "-") != -1, [AlternateGrouping], [Grouping])``
Days Between Two Dates
``daysbetween([Date1], [Date2])``
Days Between a Start Date and Now
``daysbetween([Date1], nowdate())``
Value Found Within Square Brackets (an example would be  in the example below)
``bracketvalue([Field])``
Named Value Found Within Square Brackets (the example below would be expecting data like [Channel: Marketing])
``namedbracketvalue([Field], "Channel")``
RESOURCES