To retrieve the fields of a record in V4 ....

Hi,
Continuing my step
from V3 to V4 …
Can you give me an
example of how to retrieve the records of a table using the Map received when
making a query?.
For example, if my
“Persons” record has the fields int numPerson, String Name and String Address, as I
get them in (1):
Backendless.Data.of( “Persons” ).find( queryBuilder,
new AsyncCallback<List<Map>>(){
@Override
public void handleResponse( List<Map> foundContacts )
{
// every loaded object from the “Persons” table is now an individual java.util.Map
(1) … ?
}
@Override
public void handleFault( BackendlessFault fault )
{
// an error has occurred, the error code can be retrieved with fault.getCode()
}
});
Thanks,

The code you provided is fine, you can retrieve the fields from a Map using Map.get(“fieldName”) method.

You can also use Persons class, if you have such.
Please refer to the docs, it has lots of examples both with Map and with your custom class: https://backendless.com/docs/android/doc.html#data_basic_search

These examples do not help me and the only thing I do is waste a lot of time trying to apply something that is very different from what was already implemented in 3.0 and that works perfectly.

Please, I need complete examples of how to perform:

  • A search of a record by retrieving the fields of a table on a MAP and how to retrieve from this MAP each field (which can be of different attributes STRING, INT, Geopoint …).

  • An update of this records (which I must first select).

  • A deletion of this record (which I must first select).

I do not know how to convert the treatment of a BackendlessCollection to a Map.

I can provide you from my App with the examples you need to get the equivalent. I only need one for each (search, update and deletion).

Many thanks in advance, I love BackEndLess and apologize for my ignorance in this migration theme …

When you retrieving data from the database in version 4 you get a Java collection (List to be presize) of objects. The objects you get are either instances of java.util.HashMap (if you use the dictionary approach) or instances of your class (when you use the class-based approach). Both approaches are documented.

In your code where you use BackendlessCollection, you can replace it with List.

When you het a collection of HashMap objects, the callback from the API will deliver to your code List<HashMap>, where every HashMap represents an object from the database. To get values for specific columns, you use the “get” method on HashMap.

If you use the class-based approach, the callback returns to your code List<YourClass>. In this case, you use fields/properties declared in your class to get specific values.

To update an object, you make a change in either HashMap instance or in YourClass instance and then use the “save” method to save it back in the database.

Hope this helps.

Mark

Hi,

My app is already enjoying the benefits of backendless 4.x and I have to
say that I have had to make many changes since it is a fairly ambitious
app, but everything works perfectly and from here my congratulations to
all your development and maintenance team for providing us with this
great tool.

I only have one
question about the chat that has my app and is that when you are under
the CLOUD99 rate you can really enjoy unlimited message traffic and
notifications without additional payment? I expect a lot of use globally

Regards,

Hi Joan,

Yes, you’re right: according to the pricing page, you only have unlimited pub/sub and push messages on Cloud99 plan. Though if you don’t need that much, you could switch to a lower plan and purchase a few function-packs (not sure if that would actually be cheaper, but function-packs can be purchased on-demand, e.g. when your app reaches the limit).

ok, thanks.