Case Function

Comments

3 comments

  • Alan Mark

    Hi Jee,

    The CASE plugin is not released, so there is no official documentation for it yet.  It will become available in 6.3.

    Here's an explanation of the expected behavior, it functions similar to SQL CASE:

    Syntax

    CASE(<default value>; <any>; <case 1>; <return value 1>; <case 2>; <return value 2>; ...)

    or 

    CASE(<default value>; <boolean condition 1>; <return value 1>; <boolean condition 2>; <return value 2>; ...)

    Description

    The CASE function exchanges values for others based on either specific cases or boolean conditions. Each case is evaluated in order. If none of the specified cases apply, the function returns the default value. Parameters must appear in pairs. The return and default values must be of the same type.

    Default values cannot be NULL.

    Alan

    0
    Comment actions Permalink
  • Jee

    Hi Alan,

    Thanks for your reply.

    But, I am getting syntax error for the below formula,

    CASE("d";#Sheet1!number;1;"a";2;"b";3;"c")

    Here, If number = 1 - it should return "a" , if number = 2 - return b, if nothing is match - return "d"

    My Input from Sheet1:

    I am not sure what is the error here.

     

    0
    Comment actions Permalink
  • Alan Mark

    Jee,

    I want to note again that this plugin is not released yet.  It's technically not supported, which is why there is no public documentation.  

    It appears to be unfinished and the first syntax example from the design document is not yet implemented. 

    I did get this working with booleans though.

    CASE( "d"; MATCHES(#number; "1"); "a"; MATCHES(#number; "2"); "b")

     

    0
    Comment actions Permalink

Please sign in to leave a comment.