Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Can we get total count of content fragment in AEM using GQL?

Avatar

Level 5

I want to query the total results obtained on a certain list of content fragments from GraphQL. Would that be possible in AEM GraphQL?

4 Replies

Avatar

Level 8

In GQL query try to give the attribute totalCount value and check the results this will provide you the total size of the content fragments

Avatar

Level 5

Hi @Manikumar didn't get you, here's an example query:

query articlesCollection {
  articlesList(variation:"en",filter: {
    _variation:{
      _expressions: [
        {value:"en"}
      ]
    },
    categoryTags: {
      _logOp:OR
      _expressions: [
        {
          value:"rally:mental-health",
          _apply:AT_LEAST_ONCE
        }
        {
          value:"rally:mental-healths",
          _apply:AT_LEAST_ONCE
        }
      ]
    }
  }) {
    items {
      id
    }
  }
}

Can you show me how would you introduce totalCount in this?

Avatar

Level 8

Can you try to add totalCount under articleList parallel to variation

If that is not working try to explore the schema which is generated you can see any attribute listed

Avatar

Level 5

Nope that's not correct. Neither totalCount sits as an attribute in any of the lists and exploring schema doesn't show any such attribute either because it doesn't exist in first place.