Hi...I have a database called "cash" set up with a column called "cashvalue".
Can anyone help me with the javascript I need to write to calculate the sum of all the values in this column and store it in a localstorage called "_cash"?
Hi...I have a database called "cash" set up with a column called "cashvalue".
Can anyone help me with the javascript I need to write to calculate the sum of all the values in this column and store it in a localstorage called "_cash"?
Hi Paul,
You can get a service result on service Success event using a variable 'data'. Than walk through the array and count the sum https://api.jquery.com/jQuery.each/
prevar arr = data._cash;
var sum = 0;
$.each( arr, function( key, value ) {
sum += value;
});/pre
Hi Kateryna,
I think you are real close to solving my issue . i have a collection "jobs" and want to sum up all the "price" values that my list service returns (it is filtered but that works). I want to put the result into "ttl_price" on my page. I cant quite figure out how to do this with this code though.
Nevermind, I figured it out with fresh pot of coffee and a few hours.