Sum values from related app if two categories are iqual to...
Hello! i´m kind of new in podio but i have several apps design with some calculation fields with JS.
My problem:
APP A:
Mes (related field from APP B)
Date
Movimiento (category Field)
Caja (Category Field)
Monto (Money field)
Other fields
APP B: (kind of estadistic app)
Mes
Calculation Fields => this is what i want to solve...
I need to sum "Monto" field, if the item has selected some category fields (Eg. Tipo = "Ingreso" and Caja = "Marcos" both at the same time). Following some of the advices of Rainer (user) i get to this code:
var monto = @All of Monto;
var tipo = @All of Tipo;
var caja = @All of Caja;
var total = 0; for(var i=0; i< monto.length; i++){
if(tipo[i] == "Ingreso" && caja[i] == "Marcos"){
total += monto[i];
}
};
total || 0
With some items works great but some times it gives me bad results...
Any help please??
Thanks in advance!
Please sign in to leave a comment.
Comments
0 comments