Like operator

2 followers
0
Avatar

 

Hi

I have to apply below SQL condition in Datameer. I have used CASE and confused on how to use LIKE "%zzzz%". Can some one please correct my logic

SQL Condition

case when Value_Type like '%PREAPPROVAL%DENIED%' then 'NA'
when Value_Type like '%PREAPPROVAL%ANA%' then 'NA'
when PROPERTY_Type like '%TO%BE%DETERMINED%' then 'NA'
else VALUE_Type;

Applied Datameer Condition


CASE(#Value_Type; #Value_Type;"LIKE '%PREAPPROVAL%DENIED%";'N/A';"LIKE '%PREAPPROVAL%ANA%';'N/A'";#PROPERTY_Type;"LIKE %TO%BE%DETERMINED%";'N/A';#Value_Type)

Aditya Koyyaamudi

Official comment

  • Avatar
    Sabeel

    Hi Aditya,

    At Datameer we have CONTAINS function which is similar to 'LIKE'. The syntax is as shown below.

    CONTAINS(<string or list>;<string>)

    (Here <string or list> can be the Sheet name or the source string. And the second option <string> is the pattern you want to search from the source string)

    You will find more details about CONTAINS function in this document link: https://documentation.datameer.com/documentation/display/DAS70/CONTAINS.

    Note that we cannot use '%' symbol for the pattern matching. You can mention the search pattern within double quotes.

    Also, Refer the document for more information on CASE function: https://documentation.datameer.com/documentation/display/DAS70/CASE

     

    Please find below example which demonstrates how to use both CASE and CONTAINS functions.

    Example:

    Formula: CASE("Does not exist";CONTAINS(#Name;"Jo") && CONTAINS(#Name;"Tra") ;"Exists";CONTAINS(#Name;"Ma") && CONTAINS(#Name;"mb") ;"Exists")

    So in your case, Please try below formula in your workbook, and let me know if this works. I will be happy to help you out in case if you encounter more problem with this formula.

    CASE(<Default_value>;CONTAINS(#Value_Type;"PREAPPROVAL") && CONTAINS(#Value_Type;"DENIED");"N/A";CONTAINS(#Value_Type;"PREAPPROVAL") && CONTAINS(#Value_Type;"ANA");"N/A"; CONTAINS(#PROPERTY_Type;"TO") && CONTAINS(#PROPERTY_Type;"BE")   && CONTAINS(#PROPERTY_Type;"DETERMINED");"N/A")

    Regards,

    Mohammad Sabeel

    Datameer Inc.

    0

1 comment

Please sign in to leave a comment.