SWITCH

  • Last update: December 31, 2025
  • Overview

    SyntaxSWITCH(Expression,Value 1,Result 1,Value 2,Result 2,...,Other result)Evaluates an expression and returns a corresponding result based on the first matching value.
    Parameter 1Expression/
    Parameter 2ValueAll results (Result 1, Result 2Result 3, ...) must be of the same data type.
    Return Value Type
    • Numeric

    • Text

    • Date/Time

    • Boolean

    Precautions

    1. If the result of the expression is Value 1, the function returns Result 1. If the result of the expression is Value 2, the function returns Result 2. If there is no matching value, the function returns Other result.

    2. If the expression is NULL, the result is NULL. 

    3. The results must be of the same data type. If you manually input NULL, it is regarded as being of the same type as the other non-null parameter. If all results are manually input NULL, it follows the same logic as manually inputting a single NULL, and field selection is allowed. 

    4. The data type of the calculation result returned by the expression must be consistent with that of the corresponding assigned value.

    Example

    FormulaResult
    SWITCH(5,3,"Today is Wednesday",4,"Today is Thursday","Friday")Friday

    For example, drag a New Calculation Column operator into the Data Transformation node and configure it, assign 1 to the new column if the Contract_Type value is Purchase Contract, 2 if Long-Term Agreement, and Others if any other contract types. Enter the formula SWITCH(Contract_Type,"Purchase Contract", "1", "Long-Term Agreement", "2", "Others"), as shown in the following figure.

    The new column with assigned values is shown in the following figure.

    Further Reading

    附件列表


    主题: Data Development - Scheduled Task
    Previous
    Next
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy