Expand my Community achievements bar.

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?

5 Replies

Avatar

Community Advisor

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

Avatar

Community Advisor

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.

Avatar

Community Advisor

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.