arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

caseWhen

This section contains reference documentation for the caseWhen function.

Returns values depending on boolean expressions. This function can only be used in an ingestion transformation function.

hashtag
Signature

caseWhen(booleanExpr1, valueIfExpr1True, booleanExpr2, valueIfExpr2True) caseWhen(booleanExpr1, valueIfExpr1True, booleanExpr2, valueIfExpr2True, ... ,valueIfFalse)

Arguments
Description

hashtag
Usage Examples

The usage examples are based on extracting fields from the following JSON documents:

Expression
Value

This function can be used in the to add northernHemisphere column:

booleanExpr1

A boolean expression

valueIfExpr1True, valueIfExpr2True

A value to return.

CASEWHEN(latitude > 0, 'North', 'South')

North

CASEWHEN(latitude > 0, 1, 0)

1

table config
{
  "latitude": 1.0
}
{
   "tableConfig":{
      "ingestionConfig":{
         "transformConfigs":[
            {
               "columnName":"northernHemisphereStr",
               "transformFunction":"CASEWHEN(latitude > 0, 'North', 'South')"
            }
         ]
      }
   }
}