0

I've got data in the GAE data store. I want to write a JDOQL against that data that takes one of the columns and rounds the value of it. Can I do this?

Matthew Bonig
  • 2,001
  • 2
  • 20
  • 40

1 Answers1

0

do you mean, can you update the data in the datastore to have the rounded value? if so, sure. just query for them, update that property, and store them back in the datastore.

if you mean, can you write a query that filters based on the rounded value instead of the real value, then also yes. you'd just adjust your queries and filter values. for example, if you want all entities with a rounded value >= 5, you'd use 4.5 as the filter value:

Query query = pm.newQuery(Foo.class, "property >= 4.5");

if you want all entities with a rounded value of 5 exactly, you'd query for everything between 4.5 and 5.5:

Query query = pm.newQuery(Foo.class, "property >= 4.5 && property < 5.5");
ryan
  • 2,687
  • 1
  • 29
  • 38