Hi, I have a rather complex query using CTE's. Whe...
# suiteql
w
Hi, I have a rather complex query using CTE's. When running the query with runSuiteQL().asMappedResults() I get 186 rows. But running it with runSuiteQLPaged() and iterating over the pages with a pageSize of 1000. it only returns 181. The 5 lines that are missing have a value in a column that the result is ordered by in the "ORDER BY". And the others have null in that column. If I remove the column from the "ORDER BY", runSuiteQLPaged() will return all results. I suspect that it has nothing to do with the CTE, only the ordering on a column that contains a lot of null values. Anyone seen the same problem?
c
Are you explicitly setting the sort order i.e. ASC or DESC? Are you explicitly telling it NULLS FIRST or NULLS LAST?
I ask because I remember having an issue with paged queries when I wasn't super explicit, even for ASC when that's technically the default
w
I'm setting it with "ORDER BY column name DESC". I do not include anything with "NULLS FIRST" or "NULLS LAST". Do you suggest that I add that?
I tried adding "NULLS LAST", it made it work! Thanks for the tip!
c
You're welcome!