Math in Calculation field

markdown21.6

 

Podio can execute 4 math actions, using the following symbols:

+, -, *, /. Here you can find more math that can be done with Podio.

Let’s say we have a number in a Number field: 321.1234

You can take the integer part by using the following Javascript:

 

var n = @Number; 
n – (n % 1) 

 

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

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 @Number with your app’s Number field. Thus, the following changes in “Modify Template”:

markdown21.1

 

give us the following result

 

markdown21.2

 

You can take the decimal part by using the following easy Javascript:

 

@Number % 1

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

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 @Number with your app’s Number field. Thus, the following changes in “Modify Template”

markdown21.3

 

give us the following result:

markdown21.4

 

You can take the power of a number by using the following Javascript:

 

var n = @Number;
var p = @Power;

if (isFinite(Math.pow(n, p)) && p >= 0) 
         Math.pow(n, p) 
else 
         null 

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

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 @Number, @Power with your app’s Number and Power fields. Thus, the following changes in “Modify Template”

markdown21.5

 

give us the following result:

markdown21.6

 

You can take the square root of a number by using the following Javascript:

 

var n = @Number;
if(n >= 0) 
     Math.sqrt(n)
else
     null 

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

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 @Number with your app’s Number field. Thus, the following changes in “Modify Template”:

markdown21.7

 

give us the following result

markdown21.8

 

You can round a number by using the following Javascript. The rounding is normal, meaning that if the decimal part is less than half, integer part does not change, otherwise it increases by one.

 

Math.floor(@Number)

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

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 @Number with your app’s Number field. Thus, the following changes in “Modify Template”

markdown21.9

 

give us the following result

markdown21.10

 

Do you prefer upwards rounding? Just copy paste the following code to a Calculation field:

 

Math.ceil(@Number)  

 

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

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 @Number with your app’s Number field. Thus, the following changes in “Modify Template”

markdown21.11

 

give us the following result

markdown21.12

No comments yet.

Leave a Reply