Counting Related Items based on a Category Selection
I'm trying to find a formula to count the number of items in a related app that have selected a particular category. For instance, we have a category in our prospect app for our Prospect Status. Options include, Mail; Responded; Do Not Contact. Is there a way from our related campaign app to have it count just the "Responded" items or just the "Do Not Contact" items?
I would ideally like to have that number in a calculation field in my related Campaign app so that it will calculate some other information for us. Is there a way to get that?
-
Hi Kim,
this returns the number for "Responded" if Prospect Status is a single choice category field:
var cat = @all of Prospect Status;
var sum = 0;
for(var i = 0; i < cat.length; i++){
if(cat[i] == "Responded"){
sum += 1;
}
};
sumFor other catgories just change cat[i] == "Responded" to cat[i] == "Do Not Contact" etc.
If it is a multichoice category field:
cat[i].indexOf( "Responded") > 1Rainer
-
Your code is ok.
Which sum did you expect?
Do you have a relationship from this app to Offers and also from Offers to this app?
If so you have 2 tokens @All of Offer Status in the dropdown list. Be sure to select the correct one.
Please check how many Offers are related: Enter cat.length as last line in the calculation field. -
I am expecting to get 52."OFFER SENT"
I made sure to to select the correct @All of Offer Status (incoming).
when I added cat.length to the last line of the calculation field I got the result of 1.
I believe its only counting how categories are selected within a specific item. I want the calculation to return the sum of all items that have "OFFER SENT" selected.
Please sign in to leave a comment.
Comments
5 comments