Nalini
Posts: 0
Joined: Tue Jan 14, 2014 2:49 pm

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

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

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

Nalini
Posts: 0
Joined: Tue Jan 14, 2014 2:49 pm

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

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

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

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

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

Nalini
Posts: 0
Joined: Tue Jan 14, 2014 2:49 pm

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

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

Nalini
Posts: 0
Joined: Tue Jan 14, 2014 2:49 pm

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

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.

Nalini
Posts: 0
Joined: Tue Jan 14, 2014 2:49 pm

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

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
Nalini
Posts: 0
Joined: Tue Jan 14, 2014 2:49 pm

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

var val=0;

if(data.length) {

Code: Select all

 for (var i=0; i).text(val);
Nalini
Posts: 0
Joined: Tue Jan 14, 2014 2:49 pm

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

var val=0;

if(data.length) {

Code: Select all

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

Return to “Issues”