Skip to main content

Calc Editor: Decimal and Integer Expressions

Part of Understanding the Calc Editor. Decimal covers numbers with a fractional part and Integer covers whole numbers. The Calc Editor treats them as two categories, and which one you are offered is decided by the type of the property you attached the calculation to.

Decimal and Integer are separate types, each with its own expression category, and a calculation is scoped to whichever type the property expects. The two lists overlap heavily rather than nesting: Decimal holds 42 expressions and Integer 33, and nine of the Decimal entries have no Integer counterpart.

Nine expressions are offered only under Decimal

Absolute-Value, Average-Array-Decimals, Average-Decimals, Latitude, Longitude, Power, Square, Square-Root and Sum-Array-Decimals appear under Decimal and not under Integer. The rest of the tables below are offered in both categories, which is a convenience of the picker and not a sign that the two types interchange. An integer value is not a decimal value; see "Mixing decimal and integer values" below for what the builder does when you combine them.

Arithmetic

Expression

What it does

Sum

Adds all terms. Accepts more than two.

Difference

The difference between terms.

Product

Multiplies all terms. Accepts more than two.

Division

Divides the first term by the second.

Remainder-Integer

The remainder of the first term divided by the second, for integers.

Power

A base value raised to an exponent.

Square

Squares its argument.

Square-Root

The positive square root of its argument.

Absolute-Value

The absolute value of its argument.

Rounding, truncating and parsing

Expression

What it does

Ceiling-Decimal

Rounds a decimal up to the next higher integer.

Floor-Decimal

Rounds a decimal down to the next lower integer.

Round-Decimal

Rounds a decimal to the nearest integer.

Truncate-Decimal

Drops the fractional part of a decimal, leaving the whole number.

Parse-String

Reads a number out of a string.

Parse-Hexadecimal-String

Reads an integer out of a hexadecimal string.

Largest, smallest and average

Expression

What it does

Max, Min

The largest or smallest value of a list of terms.

Max-Array, Min-Array

The largest or smallest value from within an array.

Average-Decimals

The average of a list of decimals.

Average-Array-Decimals

The average of decimals from within an array.

Counting and totalling array rows

Expression

What it does

Sum-Array-Integers

The total of integers from within an array.

Sum-Array-Decimals

The total of decimals from within an array.

Count-In-Array

The number of items in an array where the filter is true.

Count-Where-True

The number of true results in a list.

Position-In-Array

The position of the first item in an array where the filter is true.

Length-Array

The number of rows in an array.

These read every row of an array and return a single number. Arrays, lists and Data Tables explains why they are filed here rather than under Array.

Position inside an array

Expression

What it does

Current-Position

The current position within a loop, counting from zero.

Current-Position-One-Based

The current position within a loop, counting from one.

See Position-Based Calculations for reading a value out of a particular row.

Reading a number out of another type

Expression

What it does

Length-String

The number of characters in a string.

Latitude

The latitude of a location.

Longitude

The longitude of a location.

Values, fields and branching

Expression

What it does

Constant

A fixed number.

Field

A reference to a numeric field.

If

Evaluates a boolean to decide which result to use.

If-Set

Uses one value if a field has a value, and another if it does not.

Integration-Data

A number sourced from integration data.

Switch-On-Integer

Selects one of a group of values by matching an integer.

Switch-On-String

Selects one of a group of values by matching a string.

Unset

An explicitly unset number.

Mixing decimal and integer values

Product and Division in a decimal calculation expect every operand to be a decimal. Drop an integer field into one of those slots and the builder does not reject it. Instead it wraps that field in a nested Product, with a second slot pre-filled with a constant of 1. That promotes the integer into a decimal-typed expression.

Expect that before you meet it, because the operator label changes and the result looks like an error without being one. When a unit conversion or a multi-step calculation combining decimal and integer fields gives a wrong answer, this is the first place to look.