Skip to main content
August 10, 2022
Question

Sorting Info throws an error when the data returned from the QE is null

  • August 10, 2022
  • 9 replies
  • 0 views

I am trying to apply sorting on the primary key, while getting data is batches its breaking when the data returned from the query entity rule is null.

If sorting based on any other fields its working fine, with or without data

Code used: 

a!pagingInfo(
startIndex: 1,
batchSize: 5,
sort: a!sortInfo(
field: "agendaItemIdPk",
ascending: true()
)
)

If we get the data we batch size -1 its working fine. Has anyone faced this issue if yes then whats the way around?

9 replies

August 10, 2022

It will be good if you can share your queryentity code .

mikes0011
Brainy
August 10, 2022

Are you saying it works with the exact same code if you change "5" to "-1" to return all rows?  Or is there another change involved?

If you're querying against a very inefficiently defined View, I suppose you could be running into an issue with QueryEntity/'s fetching of TotalCount.  If you don't have "fetchTotalCount" manually defined, it'll behave differently (iirc) between passing "-1" for batchSize and passing an actual batch size (i.e. 5).  I could imagine a scenario where just the attempt to fetch the total count causes the query to time out - and for the error message you posted, the query timing out is the most common underlying cause i've seen (though you should check your Tomcat-STDOUT.log file for more detail, it'll probably tell you exactly what the query issue was).

The Expression Guru
August 10, 2022

The view is not timing out, did check that.

ex. in the below example if I pass the batch size as 5 for the user its erroring out

while for the same user if I am passing the batch size as -1 its not, a datasubset with null data is provided as output

August 10, 2022

As per my analysis, the combination of

batchSize <> -1 and the sorting on primary key is errored out