Post

3 followers Follow
1
Avatar

If Then Relationship Category with Count

I have an app A and B connected via a relationship.

In app B I have a category field with 3 options (Active, Dead, Converted)

How can I create a calculation in app A where I can get a total count of all B items connected to A only if the Category field equals "Active"?

Thanks in advance.

Faisal Velani

Please sign in to leave a comment.

1 comment

0
Avatar

Hi Faisal,

var cat = @all of your category field;
var sum = 0;
for(var i = 0; i < cat.length; i++){
     if(cat[i] == "Active"){
        sum += 1;
    }
};
sum

Rainer

Rainer Grabowski 0 votes
Comment actions Permalink