get users list properties

Hello, i am trying to get the size of a list of diplomats from a relation in my user properties
my user contain a relation property named Diplomats related to an object Diplomat and i want to display the number of diplomats of the user, i tried the aproch discribed in the documentation but it didn’t work for me
can you help me do that?

Hey Ahlem

Could you please provide your appId and link to documentation sample what you tried use

Regards, Vlad

this is my app id : E511D04A-E2AD-039A-FF87-D750F0C22500 i tried several approches that i found in documentation like getting a list of objects

Hi Ahlem,
Please try do the next steps

  • get user relations by its id
  • get the value of total objects of the relations
StringBuilder whereClause = new StringBuilder();
whereClause.append( "User[Diplomats].objectId='" ).append( "YOUR_USER_ID" ).append( "'" );


BackendlessDataQuery dataQuery = new BackendlessDataQuery();
dataQuery.setWhereClause( whereClause.toString() );


Backendless.Persistence.of( Diplomat.class ).find( dataQuery,
new AsyncCallback<BackendlessCollection<Diplomat>>()
{
@Override
public void handleResponse( BackendlessCollection<Diplomat> relatedDiplomats )
{
relatedDiplomats.getTotalObjects();
}
@Override
public void handleFault( BackendlessFault fault )
{
System.out.println(fault.getMessage());
}
}
);

Regards Ilya