Post

2 followers Follow
0
Avatar

How do I setup a calculation to pull one item from a Relationship field with multiple items

Hey All,

On one of our Podio apps we have a Team Member relationship field where all of the team members are listed and in the new reporting app I am working on I would like to have each team member in their own field so the reporting templates can just pull the info for specific team member for the different reports. How do I go about setting up my calculation so that Team Member field 1 pulls the Relationship badge of the team member in the first position in old app Team Member relationship field and do the same for the preceding members?

Thanks

An Vo

Please sign in to leave a comment.

4 comments

0
Avatar

Hi An,

you can get each one by it's index. The oldest created you get by 
String(@all of member[0]), the next one by String(@all of of member[1]) and so on.
But your set up will create problems. 
Imagine you have a calculation field for user String(@all of member[6]). Now that member leaves your team and the member item maybe will be deleted. Then member[7] becomes member[6] .  

Keep in mind: You can get the members only by the order their items have been created, not by the order they are added to the relationship field. 

Rainer

Rainer Grabowski 0 votes
Comment actions Permalink
0
Avatar

Hi Rainer,

Thank you for answering my question, but with this method don't I have to know which team member is being listed? The String(@all of member[0]) method would only list the team member being indexed and not the members that are listed in the relationship field, correct? 

Thanks

An Vo 0 votes
Comment actions Permalink
0
Avatar

Hello An,

no, not correct :)
If you've 5 members in your relationship field and you call them by @all of members you'll get an array (where the numbers should be the unique id of their items): 
[member9,member10,member15, member16,member17]
@all of members[0] = member9 (it's the member item with the lowest unique ID of these 5 related members. 

If you've in another relationship field 
[member1,member2,member3]
@all of members[0] = member1  

Basically, the following applies for calculation fields: You can get data from items only which are related to the item whre you want to show the calculation result (if you want data from items which are not directly related but related to a a directly related you must have their data also in the directly related item. Example: You've a calculation field in App A, which is directly linked to App B which is linked to App C. If you want data from C in A these C-data must also be available in B, e.g. in a calculation field with @all of C). 

Hope this helps
Rainer


Rainer Grabowski 0 votes
Comment actions Permalink
0
Avatar

Hey Rainer,

I've got most of the info I need with String(@all of field[0]) you suggested, but I am unable to pull the email address info. I've tried @All of Email Address.map(function (obj) { return obj.value}).toString() that you have suggested in another post but that just pulls all of the email addresses in the Team Member relationship field. Is there option for the String method but to pull only the Work email addresses?

Thanks

An Vo 0 votes
Comment actions Permalink