Can we get total count of content fragment in AEM using GQL? | Community
Skip to main content
Level 4
November 11, 2022

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

  • November 11, 2022
  • 2 replies
  • 1384 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Mani_kumar_
Community Advisor
Community Advisor
November 12, 2022

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

Level 4
November 12, 2022

Hi @mani_kumar_ 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?

Mani_kumar_
Community Advisor
Community Advisor
November 12, 2022

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

Kishore_Kumar_
Level 9
January 26, 2023

Hi @spidey1405 ,

 

I don't think there is OOTB Helper Fields to provide the size. Please let me know if you had find any, else on consumption side we need to find.