Date: Thu, 16 Sep 2021 15:13:05 +0000 (GMT) Message-ID: <1055314615.2845.1631805185758@9c5033e110b2> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_2844_1454170221.1631805185757" ------=_Part_2844_1454170221.1631805185757 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html Numeric Operators

# Numeric Operators

Contents:

=20

=20
=20
=20

=20
=20

Numeric operators enable you to generate new values based on a compu= tation (e.g.=20 `3 + 4`).

For each expression, the numeric operator is applied from left to right:=

=20
```(left-hand=
side) (operator) (right-hand side)```
=20

These evaluations result in a numeric output, which can be an Integ= er or Decimal depending on the input values. The followin= g operators are supported:

=20 =20 =20 =20 =20 =20
Operator Name Symbol Example Expression Output Notes
add `+`

`3 + 6`

`9`
subtract `-`

`6 - 5`

1
multiply *

`3 * 6`

`18`
divide /

`25 / 5`

`5`
modulo % `5 % 4` `1` Computes the remainder as an integ= er of the first parameter divided by the second parameter. Input parameters= must be Integers, column references to Integers, or an expression that eva= luates to an Integer.
power `pow` `pow(4,3)` `64` Power is implemented as a function= . see POW Function.
negate `-` `-myColumn` opposite of the value in ```myC= olumn``` This operator supports only one op= erand. Parenthetical references are supported. See the example below.

The above examples apply to integer values only. Below, you can review h= ow the comparison operators apply to different data types.

## Usage

Numeric operators are used to perform numeric manipulations on columns o= f data, Integer or Decimal constants, or both. Typically,= they are applied in evaluations of values or rows.

Example data:

X Y
2 1
6 4
7 10
10 0

Transforms:

=20

derive type:single value:(X + Y) as:= 'add'

=20

derive type:single value:(X - Y) as:= 'subtract'

=20

derive type:single value:(X * Y) as:= 'multiply'

=20

derive type:single value:(X / Y) as:= 'divide'

=20

derive type:single value:(X % Y) as:= 'modulo'

=20

derive type:single value: pow(X,Y) a= s: 'power'

=20

derive type:single value: -(X-Y) as:= 'negativeXminusY'

Results:

Your output looks like the following. Below, `(null value) indicates that a null value is generated for the computation.`

``` =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 X Y add subtract multiply divide modulo power negativeXminusY 2 1 3 1 2 2 0 2 -1 6 4 10 2 24 1.5 2 1296 -3 7 10 17 -3 70 0.7 7 282475249 3 10 0 20 10 0 (null value) (null value) 1 -10 Examples Tip: For additional examples, see Common Tasks. NOTE: When a numeric operator is applied to a set of va= lues, the type of data of each source value is re-inferred to match any lit= eral values used on the other side of the expression. This method allows fo= r more powerful comparisons. In the following examples, values taken from the MySource c= olumn are re-typed to match the inferred data type of the other side of the= expression. add =20 =20 =20 =20 =20 Column Type Example Transform Output Notes Integer/Decimal =20 derive type:single value:(MySource += 5)=20 keep row:(MySource + 2.5) Generated values are sum of values in M= ySource column and the constant (5 or 2.5).    Datetime You cannot directly add Datetime values. You can= use the DATEDIF function to generate the number of days diffe= rence between two date values. See DATEDIF Function.     String You cannot add strings together. You can use the MERGE transform to concatenate columns of = string values together. See Merge= Transform. You can use the ARRAYCONCAT function to concatenate multip= le columns of array type together. See ARRAYCONCAT Function.      For computational purposes, all data ty= pes not previously listed in this table behave like strings. subtact =20 =20 =20 =20 =20 Column Type Example Transform Output Notes Integer/Decimal =20 derive type:single value:(MySource -= 5)=20 derive type:single value:(MySource -= 2.5) Generated values are difference between va= lues in   MySource   column and the constant (5 or 2.5).   Datetime You cannot directly subtract Datetime valu= es. You must use the DATEDIF function to genera= te the number of days difference between two date values. See DATEDIF Function.     String You cannot differentiate strings direct= ly. You can use the SUBSTRING function to locate one str= ing within the other. If found, this function returns the index of the valu= e in the source string where the substring is located. This index value can= used as an input to the LEFT and RIGHT functions= to remove the substring. See = SUBSTRING Function.   For computational purposes, all data types= not previously listed in this table behave like strings.     multiply =20 =20 =20 =20 =20 Column Type Example Transform Output Notes Integer/Decimal =20 derive type:single value:(MySource *= 5)=20 derive type:single value:(MySource *= 2.5)     Generated values are the product of values in th= e MySource column and the constant (5 or 2.5).   Datetime N/A     String N/A     divide =20 =20 =20 =20 =20 Column Type Example Transform Output Notes Integer/Decimal =20 derive type:single value:(MySource /= 5)=20 derive type:single value:(MySource /= 2.5) Generated values are the values in the MySource column divided by the constant (5 or 2.5)= .     Datetime N/A     String N/A     modulo =20 =20 =20 =20 =20 Column Type Example Transform Output Notes Integer =20 derive type:single value:(MySource %= 5) Generated values are the values in the MyS= ource column divided by the constant (5 or 2.5).    Decimal =20 derive type:single value:(MySource %= 2.5) Not supported. Inputs must be of I= nteger type.   Datetime N/A     String N/A     =20 See Also:=20 =20 =20 =20 Page:= =20 =20 =20 SIGN Function= =20 =20 =20 =20 Page:= =20 =20 =20 NEGATE Function<= /a>=20 =20 =20 =20 Page:= =20 =20 =20 MULTIPLY Funct= ion=20 =20 =20 =20 Page:= =20 =20 =20 SUBTRACT Funct= ion=20 =20 =20 =20 Page:= =20 =20 =20 DIVIDE Function<= /a>=20 =20 =20 =20 Page:= =20 =20 =20 ADD Function=20 =20 =20 =20 Page:= =20 =20 =20 MOD Function=20 =20 =20 =20 Page:= =20 =20 =20 DEGREES Functio= n=20 =20 =20 =20 Page:= =20 =20 =20 TRUNC Function=20 =20 =20 =20 Page:= =20 =20 =20 ROUND Function=20 =20 =20 =20 Page:= =20 =20 =20 RADIANS Functio= n=20 =20 =20 =20 Page:= =20 =20 =20 EXAMPLE - RANDBETWEEN and PI Functions=20 =20 =20 =20 Page:= =20 =20 =20 NUMFORMAT Fun= ction=20 =20 =20 =20 Page:= =20 =20 =20 FLOOR Function=20 =20 =20 =20 Page:= =20 =20 =20 EXP Function=20 =20 =20 =20 =20   ```
``` ------=_Part_2844_1454170221.1631805185757-- ```