You are viewing content for 4.5 | 4.4 | 4.3 | Previous Releases

# Formula Functions

Incorta provides the ability to create new formula columns in the business schema view or within an insight on a dashboard using a comprehensive library of formula functions.

Here is a list of supported functions when creating a new formula Alan: “Here is a list of functions available for creating new formulae [formulas]”

Group Description
Aggregation Functions Summarize the contents of a column of data
Boolean Functions Evaluate one or more expressions and return a boolean value
Conditional Statements Evaluate and return the results of an expression depending on the result of evaluating a boolean expression
Conversion Functions Converts values from one type to another
Filter Functions These functions are used to filter data to those items before or after a specified date. It is also possible to filter the data in groups
Miscellaneous Functions Various functions for finding values in table hierarchies, setting schema refresh interval and determining the row number in a query
Arithmetic Functions Perform math operations on values
Date Functions Adjust values of type date or timestamp
String Functions Convert, truncate and search within text strings

## How to Read Formula Function Reference Entries

Formula Function reference entries contain sections:

• Example(s) : includes a verbal description of a problem followed by how the solution looks in Incorta
• Syntax : the function prototype
• Notes : description of operation, context, details to pay attention to, limitations

### Typefaces

The reference entries use typefaces in the following way:

Format Meaning Example
italic variable var or \$var
bold constant true
fixed code phrase `FindMedia(op_count,location)`

### Expressions

Formula functions take expressions as well as literals as arguments. For example, a column called x might contain strings which are actually numbers: “45.6”, “77.12”, “45.91”, … To find the average of the values in that column requires the strings be converted to numeric scalars. The formula function `double` does this. You could then write `average(double(x))`. In this case, an expression is passed to `average`.

Reference entries describe expressions using the `expr` keyword. For example, `double expr` means “expression evaluating to `double`”. More generally, `<type> expr` if more than one Incorta type can be passed as an argument.

### Incorta Types

Incorta types have the same characteristics as the Java types. They are:

• `string` — series of characters
• `date` — contains month, day and year
• `timestamp` — contains month, day, year and time
• `int` — 32 bit signed integer type
• `long` — 64 bit signed integer type
• `double` — 64 bit floating point type

### Example Reference Entry

Below is an example reference entry. The fictional function being documented is called `FindMedia`.

#### FindMedia

Function `FindMedia` returns a book or movie recommendation given one or more themes.

##### Example

Use `FindMedia` to get a recommendation for a movie title incorporating “neo noir” and “science fiction” themes.

``FindMedia("film", "neo noir", "science fiction")``

In this example, `FindMedia` returns “Blade Runner”.

##### Syntax
``FindMedia(str media, string theme1, . . ., string themeN)``
• media : `string` to select media type
• themeN : `string` describing the desired themes

###### Returns

`string`

##### Notes

Function `FindMedia` takes a media type, media and one or more theme strings, theme1 …, and returns a title of type `string` whose themes match those requested.

The media value can be “film” or “book”. Currently interactive media is not supported. The themeN values are restricted to a maximum of 7: theme0theme6.

Function `FindMedia` does not support negation of the media or themeN strings.

Note that when more than three theme strings are passed, performance will begin to degrade. Be patient if you need to pass more than three themes.