Skip to main content
Solved

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


Forum|alt.badge.img+6

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?

Best answer by mattmurph9

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.

View original
Did this topic help you find an answer to your question?

4 replies

  • Practitioner
  • 9 replies
  • Answer
  • August 11, 2023

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
  • 9 replies
  • August 11, 2023

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
      }
    }
  }
}

 


  • Seasoned Practitioner
  • 223 replies
  • August 14, 2023

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


Forum|alt.badge.img+6

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


Reply


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings