RecordsGetter.getAll query for nested object

Hi!

I am overriding some of the routes to fulfill my need. I have an object A that belongs to object B.
I am using the following code to get a list of object A with some filters:

const fields = {
    field1: "X",
    field2: "Y"
}
const objectsA = await recordsGetter.getAll({ fields }: Query);

My question is: Is it possible in this same query to add a filter on object B.
I am asking because I see that the information of the full related object B is available when doing the above query. But I just want to know if there is already a way to play with the Query object.
Ideally, this is what I need:

const fields = {
    field1: "X",
    field2: "Y",
    objectB: {
        field3: "Z"
    }
}
const objectsA = await recordsGetter.getAll({ fields }: Query);

Hope that was clear.
Thank you,
Alex

Hi @alexphiev :wave:
Unfortunately we don’t provide any function or something like that, to play with query filter.
But you can create it.
To create a filter you can do something like that:

const filters: string = '{ "field":"objectB: field3", "operator":"equal", "value":"Z" }'
const objectsA = await recordsGetter.getAll({ filters }: Query);

Be careful :warning: this gonna replace the filter come from the frontend app.
If you want to merge the filter come from the frontend and yours, you must do it manually.

Let me know if it’s help.

Thank you @Arnaud_Moncel , that helps already for the query format.
I tried and it works for objectB that belong to objectA. But I am trying to filter for objectC which belongs to objectB. I see it’s not possible with the filters in the forest app.

I tried the following query: “objectB:objectCId” and also “objectB:objectCIdKey” but without success. Although the “objectCId” should be in the objectB table as a foreign key.

I get a “column objectB.objectCId does not exist”.

Full query:

{
    "aggregator": "and",
    "conditions": [
      {
        "field": "objectB:objectCId", 
        "operator": "equal",
        "value": "570"
      },
      {
        "field": "field1",
        "operator": "equal",
        "value": "value1"
      }
    ]
  }

I see what you want to achieve but, unfortunately it is not possible today.
I’m gonna push your request to our product board.
Let me know if can i help for something else.

Ok, thank you anyways :slight_smile: