Skip to main content
Seasoned ⭐️⭐️⭐️
Aug 9, 2023 2:43 PM UTC
Solved

[FDM] How to filter custom array properties in a GraphQL query

I have some views with simple array properties (arrays of primitives) and others with arrays of relationships to views (edges).

Location view

I can filter the simple arrays with the “containsAll” or “containsAny” methods.

But there seems to not be a filter avaiable for the edges in the Graphql API.

 

How can I filter by these properties via the GraphQL API?

Practitioner ⭐️⭐️⭐️
Aug 11, 2023 6:45 PM UTC

We currently don’t support filtering on properties of related nodes from a 1:many relationship. But we do support filtering on properties that are related in a 1:1 relationship.

4 replies

Practitioner ⭐️⭐️⭐️
Aug 11, 2023 6:45 PM UTC

We currently don’t support filtering on properties of related nodes from a 1:many relationship. But we do support filtering on properties that are related in a 1:1 relationship.

Practitioner ⭐️⭐️⭐️
Aug 11, 2023 6:56 PM UTC

Though if you instead query for the related type (say Role from your above types), and add a 1:1 relation back to the ‘parent’ (User in this case), you can then filter on properties of the User and Role. So the Role type and query would become
 

type Role {
...
user: User
}


{
listRole(filter: { and: [ { ...some filter on properties of Role }, { user: { ...some filter on properties of User } } ] }) {
items {
externalId
roleName
user {
externalId
}
}
}
}

 

Expert ⭐️⭐️⭐️⭐️
Aug 14, 2023 5:59 AM UTC

Hi @Lucas Carvalho de Sousa, did the above help?

Seasoned ⭐️⭐️⭐️
Aug 14, 2023 12:42 PM UTC

Hello @Carin Meems, it helped understand that what I wanted to do is not possible right now, but it its a possible workaround that I am investigating