Turn Phone field into Text in a Calculation field

markdown13.6

 

This is a very useful feature, sometimes we need to write all the phone numbers of a Number field into a Text field. Just copy paste the following code to a Calculation field:

 var i;
var all_phones = “”;
var p = @Phone;

for(i = 0; i < p.length ; i++){
    all_phones += “**” + 
                  p[i].type.charAt(0).toUpperCase() +  
                  p[i].type.slice(1) + 
                  “**: ” +

                  p[i].value + 
                  “\n\n”;
}
all_phones 

/* ——————————————————————————————————-

Created by BendixKiel ApS – Copenhagen based Podio Preferred Partner -with more than 6 years of experience in helping organizations implement Podio. Please feel free to contact us if you need help evaluate, structure or implement Podio in your organization.

BendixKiel ApS www.bendixkiel.org +45 71 99 05 80 anders@bendixkiel.org

———————————————————————————————————– */

 

Make sure you replace the @Phone field with your app’s Phone field. Thus, the following changes in “Modify Template”:

markdown13.1

 

give us the following result:
markdown13.2

Do you want to take only the first number of a Phone field?  Just copy paste the following code to a Calculation field:

@Phone[0].value  

/* ——————————————————————————————————-

Created by BendixKiel ApS – Copenhagen based Podio Preferred Partner -with more than 6 years of experience in helping organizations implement Podio. Please feel free to contact us if you need help evaluate, structure or implement Podio in your organization.

BendixKiel ApS www.bendixkiel.org +45 71 99 05 80 anders@bendixkiel.org

———————————————————————————————————– */

 

Make sure you replace the @Phone field with your app’s Phone field. Thus, the following changes in “Modify Template”.

markdown13.3

give us the following result

markdown13.4

What happens in case you want to get the @All of Phone?  You need to write something different:

var r = “”;

r += @All of Phone[0].value;

/* ——————————————————————————————————-

Created by BendixKiel ApS – Copenhagen based Podio Preferred Partner -with more than 6 years of experience in helping organizations implement Podio. Please feel free to contact us if you need help evaluate, structure or implement Podio in your organization.

BendixKiel ApS www.bendixkiel.org +45 71 99 05 80 anders@bendixkiel.org

———————————————————————————————————– */

That is because the type of @All of Phone[0].value cannot be identified as a Text, what is just done is assign a Text field and then append the @All of Phone value.

 

Do you want to take all the phone numbers of a Phone field? They will be separated with commas, in this case. Just copy paste the following code to a Calculation field:

var i;

var all_phones = “”;
var p = @Phone;

for(i = 0; i < p.length ; i++){
all_phones += p[i].value +
“, “;
}
all_phones = all_phones.substring(0, all_phones.length – 2);
all_phones

/* ——————————————————————————————————-

Created by BendixKiel ApS – Copenhagen based Podio Preferred Partner -with more than 6 years of experience in helping organizations implement Podio. Please feel free to contact us if you need help evaluate, structure or implement Podio in your organization.

BendixKiel ApS www.bendixkiel.org +45 71 99 05 80 anders@bendixkiel.org

———————————————————————————————————– */

Make sure you replace the @Phone field with your app’s Phone field. Thus, the following changes in “Modify Template”:

markdown13.5

 

give us the following result

markdown13.6

 

No comments yet.

Leave a Reply