Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version next

...

D s
snippetBasic

COALESCE
d-codelang-syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value:
coalesce([col1,col2,col3]) as: 'firstValue'

...

coalesce([col1,col2,col3])

Output: Returns the first non-missing detected in col1, col2, or col3 in that order.

D s
snippetSyntax

COALESCE
d-codelang-syntax
RawWrangletrue
Typesyntax
showNotetrue
WrangleTextderive type:single value:
coalesce([col_ref1,col_ref2, col_ref3])

coalesce([col_ref1,col_ref2, col_ref3])

A reference to a single column does not require brackets. References to multiple columns must be passed to the function as an array of column names.

ArgumentRequired?Data TypeDescription
col_ref1YstringName of the first column to find the first non-missing value
col_ref2NstringName of the second column to find the first non-missing value
col_ref3NstringName of the third column to find the first non-missing value

...

RacerHeat1Heat2Heat3
Racer X 38.2237.61
Racer Y41.33 38.04
Racer Z39.2739.0438.85

TransformTransformation:

Use the following transform to grab the first non-missing value from the Heat columns:

d-

...

trans
RawWrangletrue
p03Value'firstTime'
Typestep
WrangleTextderive type:single value:

...

coalesce([Heat1, Heat2, Heat3]) as:'firstTime'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02Valuecoalesce([Heat1, Heat2, Heat3])
p03NameNew column name
SearchTermNew formula

Results:

RacerHeat1Heat2Heat3firstTime
Racer X 38.2237.6138.22
Racer Y41.33 38.0441.33
Racer Z39.2739.0438.8539.27

...