In my app, first i get a list of 100 prescritptions created by different users. Now each prescription has ownerid field, and i want to show name of the user who created this prescription.
For this purpose, one way is to query user tables and get all the users whos id is either id 1 or id 2 or id3 and so on,
or is there more simple way like? /users?ids=id1,id2,id3 and so on?
So is there any other method available than [1] where im forced to make a big query of ids.
If it was a relation, then you would be able to just load the related Users in the same request. Unfortunately, ownerId field is not a relation, so your approach looks like a proper one.
We have a speacial syntax in where clause suited just for your case: where objectId IN (id1, id2, idx)
Users -> Prescription is a one to many relation from Users to Prescriptions, i was able to load prescriptions of a Single User in single request,
however when i want to load most recent created prescriptions, then how can i load its associated relation in a single requet? Last time i checked if first 50 prescriptoins were created by 50 different users then i was suppose to make 50 calls to load related users. Thats why i didnt go for that?
If its possible please guide using Rest.
In case you don’t have a relation from Prescription to Users there’s no way to retrieve Users while querying Prescription. It would be possible if the relation was reversed.
In some other cloud a relation is always 2 ways, so you can always retrieve prescriptpions of a user, or users of given prescriptions. Please try implementing this feature in next major update.
Inside the loop in wich you are obtaining the id, save the object directly in the list trough ‘get object by Id’, in the end you’ll get the list of objects