maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Calculations from a database

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.

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

Calculations from a database

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

Thanks

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

Calculations from a database

Hi,

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

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

Calculations from a database

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

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

Calculations from a database

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

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

Calculations from a database

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 ? :-)

EJLD
Posts: 0
Joined: Sun Jun 08, 2014 11:03 pm

Calculations from a database

I found a bypass to my above question.
best

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Calculations from a database

Hello EJLD,

Thanks for your update.

Regards.

Return to “Issues”