Table rows not loading

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.

Just a stab in the dark… any chance that the 22 missing records have a blank in the order by field?

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

Matt, thanks for the advice. All missing records do have the sorted field - no blanks…

Chelsea, can you try ordering by Id as your secondary ordering option? Like put order by “MyOriginalOrderingField, Id” in your OrderBy property.

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.

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?

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.

Can the “, Id” automatically be added since it is an expected weirdness with Standard Set Controllers?

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.