Excerpt |
---|
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.
D lang syntax |
---|
RawWrangle | true |
---|
Type | ref |
---|
showNote | true |
---|
WrangleText | derive type:single value: lcm(10,4) as:'twenty' |
---|
|
lcm(10,4) |
Output: Returns the least common multiple between values 10
and 4
, which is 20
.
D lang syntax |
---|
RawWrangle | true |
---|
Type | syntax |
---|
showNote | true |
---|
WrangleText | derive type:single value:lcm(value1, value2) |
---|
|
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. |
value1, value2
Integer expressions, column references or literals to multiply together.
- Missing or mismatched values generate missing string results.
Required? | Data Type | Example Value |
---|
Yes | Literal, function, or column reference returning an Integer value | 15 |
Example - Basic LCM function
Source:
string | repeat_count |
---|
ha | 0 |
ha | 1 |
ha | 1.5 |
ha | 2 |
ha | -2 |
Transformation:
D trans |
---|
RawWrangle | true |
---|
p03Value | 'repeat_string' |
---|
Type | step |
---|
WrangleText | derive type:single value: repeat(string, repeat_count) as: 'repeat_string' |
---|
p01Name | Formula type |
---|
p01Value | Single row formula |
---|
p02Name | Formula |
---|
p02Value | repeat(string, repeat_count) |
---|
p03Name | New column name |
---|
SearchTerm | New formula |
---|
|
Results:
string | repeat_count | repeat_string |
---|
ha | 0 | |
ha | 1 | ha |
ha | 1.5 | |
ha | 2 | haha |
ha | -2 | |