i have the following Factory function that execute an SQLite Select statement to get the sum of a column.
myDataFactory.OrderedDishesCountByCategory = function (CategoryNo, callback) {
$ionicPlatform.ready(function () {
var query = "SELECT ifnull(SUM( qty ),0) as ordercount FROM dishesmenu WHERE dishcategory = ?";
$cordovaSQLite.execute(db, query, [CategoryNo]).then(function (result) {
console.log(result.rows.item(0).ordercount);
callback(result);
});
})
}
in the above am returning the result, but i want to get only the “ordercount”, i mean
result.rows.item(0).ordercount
so when i call this function from the controller i can set this value to some variable directly.
is that posible and how ?