LCM Function
Returns the least common multiple shared by the first and second arguments.
Each argument can be a literal Integer number, a function returning an Integer, or a reference to a column containing Integer values.
Wrangle vs. SQL: This function is part of Wrangle, a proprietary data transformation language. Wrangle is not SQL. For more information, see Wrangle Language.
Basic Usage
lcm(10,4)
Output: Returns the least common multiple between values 10
and 4
, which is 20
.
Syntax and Arguments
lcm(value1, value2)
Argument | Required? | Data Type | Description |
---|---|---|---|
value1 | Y | string | The first value must be an Integer literal, column reference, or expression that evaluates to an Integer value. |
value2 | Y | string | The first value must be an Integer literal, column reference, or expression that evaluates to an Integer value. |
For more information on syntax standards, see Language Documentation Syntax Notes.
value1, value2
Integer expressions, column references or literals to multiply together.
Missing or mismatched values generate missing string results.
Usage Notes:
Required? | Data Type | Example Value |
---|---|---|
Yes | Literal, function, or column reference returning an Integer value | 15 |
Examples
Sugerencia
For additional examples, see Common Tasks.
Example - Basic LCM function
Source:
string | repeat_count |
---|---|
ha | 0 |
ha | 1 |
ha | 1.5 |
ha | 2 |
ha | -2 |
Transformation:
Transformation Name | |
---|---|
Parameter: Formula type | Single row formula |
Parameter: Formula | repeat(string, repeat_count) |
Parameter: New column name | 'repeat_string' |
Results:
string | repeat_count | repeat_string |
---|---|---|
ha | 0 | |
ha | 1 | ha |
ha | 1.5 | |
ha | 2 | haha |
ha | -2 |