How to best work with a list of child objects (relations) from a DB query

I am retrieving some objects using a DB query, but what I really want to get to is the child objects (related objects of a related object) from this table. I want to store these for use later in pageData.

How can I get pageData to store only the “child object” in the load data returned? Or how can I restructure my load data to return what I want in the first place without the need for the top levels?

This is how my UI Builder load data block looks:

This is what I get as data back from this query:

Is there an easier way for me to “peel of these layers” around the sub objects that I want to work with?

I was able to rework this in reverse, which fixed the problem, but it would be nice to know if one can get to a subObject like in the example above anyway…

Hello, @Egil_Helland.

If you want exclude some properties of object you need to use field exclude properties.

Regards, Nikita.

No, I was looking more at how to unpack an object with child objects so that I can work more comfortably only with the child object. In my results above, it is grandparent[parent][child0,child1…]. I want to just temporary get rid of the grandparent and parent objects to iterate over the child objects only.

If I correctly understand your requirements you want to achieve this:

  1. you have parent object - A;
  2. in this object you have object - B;
  3. and in object B you have object - C;
  4. you want to get only object C from this request.

To achieve this you can use Get property of block like this:
Get property C of(Get property B of A).
image

Regards, Nikita.

Aha, that easy…! Thanks! :slight_smile: