Query Entity: fetchtotalcount is not working

Dear Team,

Could someone help me to understand the below issue please.

I am trying to fetch the total count of the records from DB view. When I give fetchTotalCount=true it's throwing an error 'Expression evaluation error at function a!queryEntity [line 2]: An error occurred while retrieving the data. Details: Unexpected error executing query'. If I change the fetchTotalCount=false, it's working fine. Sample  code is below:

a!queryEntity(
entity: cons!DB_VIEWS_DSE,
query: a!query(
selection:
a!querySelection(
columns: a!queryColumn(
field: "id"
)
),
pagingInfo:
a!pagingInfo(
startIndex: 1,
batchSize: 1,
sort: {
a!sortInfo(field: "id", ascending: false())
}
)
),
fetchtotalcount: true
)

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Thanks for the response Peter. For my requirement we are joining morethan 7 tables and applying more conditions to filter(Around 4k lines of code). I can't see flexibility by using Records. If I used fetchtotalcount as false and batch sizd is -1 then I am able to get all 70k records in one go but if I change the totalcount as true even 1 record also not fetching and throwing an error.  Can you please explain how the fetchtotalcount will work in appain ? I mean what type of logic they written inside and how the calculation will happen internally