Page 3 of 4

Calculate average from values in database, then show output in UI labels

Posted: Fri Jan 17, 2014 7:31 pm
by Nalini

Thank you. I made the change and now I'm getting the average as an alert when I'd like it to show up on one of my labels on the UI


Calculate average from values in database, then show output in UI labels

Posted: Fri Jan 17, 2014 8:20 pm
by Kateryna Grynko

Run this:preAppery("labelName").text(val);/pre


Calculate average from values in database, then show output in UI labels

Posted: Sat Jan 18, 2014 6:06 pm
by Nalini

where should I run this? from events, within query service or on 'search' button?


Calculate average from values in database, then show output in UI labels

Posted: Sat Jan 18, 2014 8:10 pm
by Illya Stepanov

Hi -- in the code that Marina advised, in the last line:
pre
...
alert(val);
/pre
change to:
pre
Appery("labelName").text(val);
/pre


Calculate average from values in database, then show output in UI labels

Posted: Sun Jan 19, 2014 2:07 am
by Nalini

This doesn't work at all. No output shows up on the label.


Calculate average from values in database, then show output in UI labels

Posted: Sun Jan 19, 2014 2:29 am
by Alena Prykhodko

Are there any error in browser console http://docs.appery.io/documentation/d...?


Calculate average from values in database, then show output in UI labels

Posted: Sun Jan 19, 2014 2:55 am
by Nalini

I'm going to review everything one more time. I didn't think what I was trying to do would be so complicated. It's taken me 3+ days to complete this 1 feature. Seems like such a fundamental feature for an app.

1) Query database on variable X and
2) return average for selected values for var Y and average for selected values for var Z
3) post the output to UI labels 1 and 2

Is my request terribly complicated? I'll review each of your steps again.


Calculate average from values in database, then show output in UI labels

Posted: Sun Jan 19, 2014 4:48 am
by Nalini

ok I think I'm close to a fix. I see output on 3 labels, but the average is not calculating correctly. Also, how can I make a heading for each of my columns. Is there an error in my js? I can't find it.

var val=0;

if(data.length) {

Code: Select all

 for (var i=0; im calculating average for two variables

Calculate average from values in database, then show output in UI labels

Posted: Sun Jan 19, 2014 4:49 am
by Nalini

var val=0;

if(data.length) {

Code: Select all

 for (var i=0; i).text(val);

Calculate average from values in database, then show output in UI labels

Posted: Sun Jan 19, 2014 4:51 am
by Nalini

var val=0;

if(data.length) {

Code: Select all

 for (var i=0; i).text(val);