Post

3 followers Follow
0
Avatar

Return Value of the @All of functions

Can anyone tell me if there is a place where there are some sort of documentation on the return type of the @All of functions depending on the type of field? I am trying to sort out contacts with no email. but i have no idea how to check if there is an actual email or not since i have no idea how the data structure is, and how to read its different values/attributes.

Christian Kuke Marslev

Please sign in to leave a comment.

5 comments

0
Avatar

Hi Christian,
some bascis you find here https://help.podio.com/hc/en-us/articles/201019358-Calculations , in particualar in the attached PDF. 

In your case I would recommend 2 ways: 
Way 1: 
In the Contacts app create a (always hidden) calculation field "Email Check" 

@email field == null ? 1 : 0

That returns 1 if there's no email. This allows you also to filter for "no email" contacts in the Contacts App view. Filter for  the field Email Check, from 1. 

Way 2: 
For getting a result in the related app (where you want to use @all of ...):
a) if you only want to know how many contacts don't have an email address:

@sum of Email Check

b) If you want to know the names: 

var check = @all of Email Check;
var name = @all of Name;
(or whatever the label of the field is)
var arr = [];
for(var i = 0; i < name.length; i++){
      if(check[i] == 1){
        arr.push(name[i]);
   }
};
arr.join("\n") 


Returns a list of the names, each name in a new line.

c) Without using the field Email Check:

var name = @all of Name;
var email = @all of Email with nulls;
var arr = [];
for(var i = 0; i < name.length; i++){
      if(email[i] == "" || email[i] == null){
        arr.push(name[i]);
   }
};
arr.join("\n")

Rainer

 
 

Rainer Grabowski 0 votes
0
Avatar

Rainer

Out of interest is it possible to embed a hyperlink into each name with the respective podio item URL in it?

Andrew Wardle 0 votes
0
Avatar

Andrew, 
it is possible. See the second comment in that threat. 
Rainer

Rainer Grabowski 0 votes
0
Avatar

Thanks Rainer, worked a treat, tolerates being embedded in a table as well

Andrew Wardle 0 votes