How many Items referenced that has multiple specific categories

Comments

2 comments

  • Rainer Grabowski

    Hi Terry,

    I assume "won" and "closed" are categories in the same multi choice category field in the Whiteboard app. And you want to count those whiteboard items where "won" and "closed" are both selected. The code:

    var cat = @All of Category; // Replace "Category" with your field name
    var count = 0;
    for(var i = 0; i < cat.length; i++){
         if(cat[i].indexOf("won") > -1 && cat[i].indexOf("closed") > -1){
             count += 1;
       }
    }
    count

    Second Code:

    var cat = @All of Category; // Replace "Category" with your field name
    vor jobTotal = @All of Job Total;
    var count = 0;
    for(var i = 0; i < cat.length; i++){
         if(cat[i].indexOf("won") > -1 && cat[i].indexOf("closed") > -1){
             count += Number(jobTotal[i]) || 0;
       }
    }
    count
    0
    Comment actions Permalink
  • Terry A. Lewis

    Rainer Grabowski "won" and "closed" are categories in different single-choice categories. But it didn't work, everything is coming back with zeros

    var cat = @All of Estimate Won?;
    var stat = @All of Work Status;
    var count = 0;
    for(var i = 0; i < cat.length; i++){
         if(cat[i].indexOf("won") > -1 && stat[i].indexOf("closed") > -1){
             count += 1;
       }
    }
    count

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk