Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

AEM 6.5 GraphQL query with filter variable of type String Array

Avatar

Level 4

Hi,

 

For the below query, I want to pass the filter variable for name. Can anyone suggest if used such type of query in the AEM? I really appreciate any help you can provide.

 

query {
  personList(filter: {
    name: {
      _logOp: OR
      _expressions: [
        {
          value: "Ramesh"
        },
        {
          value: "Smith"
        }
      ]
    }
  }) {
    items {
      name
      firstName
    }
  }
}

  

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @MukeshAEM , Can you please try something like below

krishna_sai_0-1676027908960.png


Hope this helps
Thanks,

Krishna

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @MukeshAEM , Can you please try something like below

krishna_sai_0-1676027908960.png


Hope this helps
Thanks,

Krishna

Avatar

Level 4

Thanks, @krishna_sai for your quick response. The only problem with this approach is I need to change the query to increase filter parameters. Wondering if it's possible to pass an array of strings as a filter parameter instead of 2 separate parameters parameter1 and parameter2. 

Avatar

Community Advisor

Hi @MukeshAEM , I don't think it is possible here name is single valued. If the filtering parameter is multivalued like tags etc. you can follow something like this mentioned in below https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/graphql-array/td-p/425661

Thanks,

Krishna