Hi.
I have a DB with some values and i cant seem to add the values from it.
Here is what i have for this
var db = Ti.Database.install('MyDB.sqlite', 'Proj'); var rows = db.execute('SELECT tid, fram, hem, inom from Proj where proj_nr=? ' , parseInt(Ti.App.projectNumber)); var sumDis=0, sumHrs=0 ; while (rows.isValidRow()) { var tid = rows.getFieldByName('tid'); var fram = rows.getFieldByName('fram'); var hem = rows.getFieldByName('hem'); var inom = rows.getFieldByName('inom'); //THIS IS WHERE THE STUFF GOES WRONG..... sumDis = sumDis + fram+hem+inom; sumHrs = sumHrs + tid; ............ } var totalDistance = Ti.UI.createTextField({ top : '234dp', right: '40dp', value : sumDis+' km' , font : { fontSize : '13dp', fontFamily : 'Arial' }, color : '#fff' }); var totalHrs = Ti.UI.createTextField({ top : '234dp', left: '40dp', font : { fontSize : '13dp', fontFamily : 'Arial' }, value : sumHrs+' minuter', color : '#fff' }); win.add(totalDistance); win.add(totalHrs);The strange thing here is that "totalHrs" is working perfect it adds up as it should but in "totalDistance" all the values just stack up after eachother.
So what is the differnce between the 2 calc? And why dont "totalDistance" add up?
I have tried to do parseInt(fram,10) + ....etc but that wont work either.
Thanx