Backendless Support
 

Loading the last object from a data table using API

Backendless Service Platform gives an opportunity to load as the first objects from a data table, so the last object from a data table using the correspondent API.  

The last object is determined by the time when it is saved in the data storage.

The most recently CREATED (not UPDATED) object is what the API returns. 

The sample code below works with the same table as the example for finding first object.

Asynchronous API sample (Android and Plain Java):
Backendless.Data.of( Person.class ).findLast( new AsyncCallback<Person>()
{
 @Override
 public void handleResponse( Person firstPerson )
 {
 System.out.println( "Name - " + firstPerson.name );
 System.out.println( "Age - " + firstPerson.age );
 System.out.println( "Birthdate - " + firstPerson.birthdate );
 }
 @Override
 public void handleFault( BackendlessFault backendlessFault )
 {
 System.out.println( "Server reported an error - " + backendlessFault.getMessage() );
 }
} );

Synchronous API sample (Plain Java only):

Person firstPerson = Backendless.Data.of( Person.class ).findLast();
System.out.println( "Name - " + firstPerson.name );
System.out.println( "Age - " + firstPerson.age );
System.out.println( "Birthdate - " + f

Review related topic:

Is article helpful?