how to retrieve proprties of a parent object ( Swift)

Hello,
I have a Request table with foundUsers column that contains a collection of objects from FoundUser table.
I created checkForRequest function to look for a user in FoundUser table whose recipientId equals the current user objectId.
I spent a lot of time trying to retrieve the properties of the related Request object. Can you please help me in the syntax?

func checkForRequest(){

 
 var whereClause : String
 var done = false
 let user = backendless.userService.currentUser
 
 if user != nil {
 
 whereClause = "recepientId = '\(user.objectId!)'"
 let dataQuery = BackendlessDataQuery()
 dataQuery.whereClause = whereClause
 let dataStore = self.backendless.persistenceService.of(FoundUser.ofClass())
 var error: Fault?
 
 let users = dataStore.find(dataQuery, fault: &error)
 
 for user in users.data!
  {
 
 if done == false {
 
 if error == nil {
 print(" \(users.data)")
  }
 else {
 print("Server reported an error: \(error)")
  }
 done = true
  }
  }
  }
}

Thank you,

my simple question is how can I search the child table with a query and retrieve its parent object ?

Hi Jane,

To retrieve the parent object, you need to search the parent table. With backendless, if you need to get an object of type A, you search in table A, which is what your code is doing anyway.

If I understood correctly, you’re asking how to get to a related object for the retrieve FoundUser objects. This can be accomplished using the relation retrieval APIs documented at:
https://backendless.com/documentation/data/ios/data_relations_retrieve.htm

Hope this helps.

Mark