I am new to GAE and my skill level in JAVA is novice to intermediate somehow..
So I need help on retriving a specific filed that is an integer from JDO, and on that do the sum all, like in excel where you select all numbers and do auto sum. Hope is clear what I wont.
This is my JDO query where i select all field and all data from my datastore using jdo:
PersistenceManager pm = PMF.get().getPersistenceManager();
List<JDO> greetings = (List<JDO>) pm.newQuery(JDO.class).execute();
How do I do to select a field from my class that is called “Cost” and make a sum off all the values tha are stored inside?
Lets say:
Type Cost
Food 30
Drink 20
Drink 10
… …
And I wont the sum of all the costs? How can I make it?
Please help me!!! And thank you!!
If it is a small dataset do the calculation in java and optionally store it in a cache and separate datastore entry.
For calculating it on many entries I would go for a map and reduce method to do calculation initially.
Check out http://code.google.com/p/appengine-mapreduce/
http://gbayer.com/big-data/mapreduce-analytics-on-google-appengine/ lists a few other alternatives, like the sharding method described by T. Abilo