Page 2 of 2

Calculations from a database

Posted: Wed Aug 07, 2013 4:34 am
by maxkatz

I'm sorry, I don't have an example. To sum the numbers, you would be using JavaScript. A REST service would only return the values which you would save into an array.


Calculations from a database

Posted: Wed Aug 07, 2013 9:26 am
by bahar.wadia

Can you show me how to save values returned from a REST service into an array ?

Thanks


Calculations from a database

Posted: Wed Aug 07, 2013 9:39 am
by Kateryna Grynko

Hi,

Sure. Please take a look at here: http://docs.appery.io/tutorials/build...


Calculations from a database

Posted: Wed Aug 07, 2013 9:56 am
by bahar.wadia

I can do this bit, but how to get data into an array for performing calculations programmatically.


Calculations from a database

Posted: Wed Aug 07, 2013 10:31 am
by Kateryna Grynko

I see, this should help you: https://getsatisfaction.com/apperyio/...


Calculations from a database

Posted: Fri Aug 29, 2014 10:23 pm
by EJLD

Hi there,

i want to do sum up data by groupby. i found some stuff on the mongodb site as follows:

Calculate the Sum
The following example groups by the ord_dt and item.sku fields those documents that have ord_dt greater than 01/01/2012 and calculates the sum of the qty field for each grouping:

db.runCommand(
{ group:
{
ns: 'orders',
key: { ord_dt: 1, 'item.sku': 1 },
cond: { ord_dt: { $gt: new Date( '01/01/2012' ) } },
$reduce: function ( curr, result ) {
result.total += curr.item.qty;
},
initial: { total : 0 }
}
}
)

how can i map that ugly stuff into your great beginner friendly Appery engine ? :-)


Calculations from a database

Posted: Sun Aug 31, 2014 2:39 pm
by EJLD

I found a bypass to my above question.
best


Calculations from a database

Posted: Sun Aug 31, 2014 11:19 pm
by Yurii Orishchuk

Hello EJLD,

Thanks for your update.

Regards.