WilliamMetz1
5 years agoQrew Member
Ajax Required?
I read the script for creating a median value from a view in quickbase and find it awesome! The only thing is, I don't have an ajax server or whatever ajax calls. So, while I was able to run your script on your page, I could not run it on mine. Is it possible to build an array from a get results set without using AJAX or other external processing things?
I can say teh following works for me, if that tells anything about what capabilities i DO have?
<script>
function median(values) {
values.sort( function(a,b) {return a - b;} );
var half = Math.floor(values.length/2);
if(values.length % 2)
return values[half];
else
return (values[half-1] + values[half]) / 2.0;
}
var list1 = [11,1,300,2,253,24,322,3,8,4,215];
document.write(median(list1))
</script>
I'm just trying to find a way to turn a quickbase query command into an array so I can use the abve logic on it.. Any thoughts?
------------------------------
William Metz
------------------------------
I can say teh following works for me, if that tells anything about what capabilities i DO have?
<script>
function median(values) {
values.sort( function(a,b) {return a - b;} );
var half = Math.floor(values.length/2);
if(values.length % 2)
return values[half];
else
return (values[half-1] + values[half]) / 2.0;
}
var list1 = [11,1,300,2,253,24,322,3,8,4,215];
document.write(median(list1))
</script>
I'm just trying to find a way to turn a quickbase query command into an array so I can use the abve logic on it.. Any thoughts?
------------------------------
William Metz
------------------------------