Table rows not loading

  • 2
  • Problem
  • Updated 3 years ago
  • Not a Problem
I have a table that has 2 conditions that are always on and 3 conditions that are off by default. The model for this table has a max# of records at 100 and is being ordered by one of the off by default conditions.

When I go to load more with this setup, it will only load 178 records when it should really be 200 records. It is excluding records I know exist.

If I leave the order by blank, it will pull in the 200 records when I load more. Why would this happen and is there a way to sort and still pull in the correct records?

Thanks.
Photo of Chelsea Curtis

Chelsea Curtis

  • 1,300 Points 1k badge 2x thumb

Posted 3 years ago

  • 2
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Just a stab in the dark... any chance that the 22 missing records have a blank in the order by field?
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
The Order By should not exclude records from the model. Seems like a bug to me.

At least according to my understanding and this article.
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_orderby.htm
(Edited)
Photo of Chelsea Curtis

Chelsea Curtis

  • 1,300 Points 1k badge 2x thumb
Matt, thanks for the advice. All missing records do have the sorted field - no blanks...
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
Chelsea, can you try ordering by Id as your secondary ordering option? Like put order by "MyOriginalOrderingField, Id" in your OrderBy property.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
That is strange. The SOQL Order By article I read didn't say anything about dropping records if the field didn't exist. Is this a Skuid Model limitation or is my understanding of the article incorrect?
Photo of Chelsea Curtis

Chelsea Curtis

  • 1,300 Points 1k badge 2x thumb
Hi Ben,

That worked! Why would I need to place the Id in this particular situation? This is the first table I've encountered where I would need to do this.

Thanks for your help.
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
The issue here is a problem with Salesforce Standard Set Controllers (which Skuid uses to load more data into models). I'm assuming that the field you're ordering on has some very similar values in it. So lots of these rows would "tie" in an ordering contest. Salesforce Standard Set controllers don't handle this very well. Say we ask for "Page 2" of the data, it could send us some records we already had, or skip some records so we never get them. The workaround is to order by something explicit where every record will have a defined and unique place in line. Yeah... so we can chalk this up to weirdness with Standard Set Controllers.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Can the ", Id" automatically be added since it is an expected weirdness with Standard Set Controllers?
Photo of Chelsea Curtis

Chelsea Curtis

  • 1,300 Points 1k badge 2x thumb
Yes, it was a list of invoices sorted by vendor, so there are multiple rows of the same vendor. Good to know. Thanks for the info.