Wildcards in Calculations

Comments

1 comment

  • Rainer Grabowski

    Hi Mario,

    as far as I know wildcards aren't possible in Javascript's .indexOf
    Do the # represent how many characters or numbers follow after A, B, C (like A 1234)?
    If so you can do it his way:

    var Stat = @Which Statutory events (cat)
    var Status = @Status
    var A1 = 0
    var A2 = 0
    var A3 = 0
    
    for(var i = 0; i < Stat.length; i++){
    if(Stat[i].indexOf("A") == 0 )
    {A1 += 1}
    if(Stat[i].indexOf("B")== 0 )
    {A2 += 1}
    if(Stat[i].indexOf("C") == 0)
    {A3 += 1}
    };
    
    Status == "Premium" && (A1+A2+A3 >= 2) ? 1 :  Status = "Regular" && (A1+A2+A3 >= 1) ? 1 : 0
    

    Rainer
    rg@delos-consulting.com

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk