Display 'parent' from 'child' side of a one to many relationship

Hi,

I’m new to backendless and really enjoying the learning experience. I’m building my first app and have hit a roadblock I can’t find a solution for. I have 2 tables - call them Clients and Contacts - where one client can have many contacts, but one contact can only have one client. I’ve created the relationship ok and the records display correctly in the Data module, but when I try to display the Contact details on a page that will include the Client name as well, I don’t know how to refer to the “One” (Client) side of the relationship. Here’s the visual schema:
image
but my problem is I don’t know how to refer to the Client info when I want to display it on a page:
image
I can refer to the child from the parent side no problems, but don’t know how to do it the other way around.
image

Any help would be appreciated.

Cheers,
Rob

Hi @Rob_Dawson ,

You can try to use inverted relations functionality to be able to access fields of parent object from a child.

Does it solve your problem?

Regards, Andriy

Thanks for your reply Andriy.

I was able to get it working by reading a number of other topic posts, and your suggestion led me to the answer. This post:

by @mark-piller Topic 2799 was the one that helped me by pointing out I needed to reference the objectId component in my context - it wasn’t implied. For anyone else who might run into this, here is the solution that worked for me:


It wouldn’t work until I explicitly referenced objectId - I thought that the value of “selectedContact” would be sufficient because it was referencing a primary key, but I was wrong.

Cheers,
Rob