LIKE or CONTAIN operator in calculation field to find part of a string

Answered

Comments

3 comments

  • Rainer Grabowski (FVM)

    With this you can get the last 4 characters of the string, than you can compare it in an IF-Condition:

    var a = @fieldName
    var b = a.slice(-4)
    b == "4321" ? "than do this" : "or do that"
    

    Rainer
    rg@delos-consulting.com

    0
    Comment actions Permalink
  • Edwin Martin

    thank you!

    0
    Comment actions Permalink
  • Adrien BLAISE

    If you just need to check whether a string contains a aubstring ("4321", regardless of its position), you can use:

    var a = @Field.indexOf("4321")
    a > -1 ? "Action if true" : "Action if false"
    
    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk