Question: "JavaScript to count contacts in app"
Hi,
I am trying to configure the app so I can make it return a count of contacts to use for calculations. But I'm having trouble referencing the contact field. I was thinking about using a JavaScript for that to put in the calculation field.
Does anybody know how I can make a JavaScript for that?
Would be great for budgeting and understanding how budgeting can be affected by team members / connected to app.
Your help is much appreciated.
Thank you!
-
Hi James, I appreciate it.
I'm not yet able to find the way to make it work, but I'll keep trying.
Ideally I would be able to put a calculation field beneath the contact field in the item, which would just give a value of x. I have found some info on how to get some counts (below is for space members) if I would go through their API, but at the moment its out of my depth in programming.
@see https://developers.podio.com/doc/contacts/get-space-contacts-22414 */ public static function get_for_space($space_id, $attributes = array()) { return self::listing(Podio::get("/contact/space/{$space_id}/", $attributes));
So I'm guessing the information is there somewhere but getting to it my problem. :(
best,
Oli -
Hi OP,
If you want to count the number of related items, pick any of the "[ ] All of X" for the desired relation. (That will return a list of X for all the related items). Type ".length" after that to get the length of the list.
The entire script should end up like "@All of Title.length" and return a number.
For contact-fields, picking the field returns a list of the contact's names and adding ".length" will usually return the desired result. So something like "@Contacts.length" in the end.
Please sign in to leave a comment.
Comments
6 comments