Table Total Record Count

  • 2
  • Question
  • Updated 2 years ago
  • Answered
Is there a way on a Skuid table to see the total number of records that meet the conditions of the model without loading them all? With a Salesforce list view, you can display 25 records, but also see how many are in the list. In a Skuid table if you are only loading 50 on the model and you have more records in the model, you have to continue to press load more until you get all of the records visible. Instead of the bottom of the table saying, "Showing Rows 1-50 of 50+" could it say, "Showing Rows 1-50 of" and then the total number of records that meet the criteria?


Salesforce List View


Skuid Table
Photo of Nate Gilbertson

Nate Gilbertson

  • 1,194 Points 1k badge 2x thumb

Posted 4 years ago

  • 2
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
You could create a second model that has the same conditions as the primary model,  but is an aggregate, and merely counts all records.  In this case, Salesforce calculate the count on the server - so you don't have to push all the records over the wire just to get the count. 

Then you could put that model field in a template field whererver you want on your page. 
Photo of Nate Gilbertson

Nate Gilbertson

  • 1,194 Points 1k badge 2x thumb
That is a great idea. Thank you!
Photo of Nate Gilbertson

Nate Gilbertson

  • 1,194 Points 1k badge 2x thumb
How do I link the two models so that ModelB(aggregation), the clone of ModelA, gets refreshed and does a new aggregation of what is being displayed in the table of ModelA when the table is searched or filtered? I tried adding a condition that said recordID = RecordID from ModelA, but that only returned one value in ModelB.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
That is a good problem.... 

The two models will not automatically synch (as you have found out).  And you wouldn't want the summary model limited to the records that are showin in the detail model - becuase of the "load more" issue you identified at the beginning. 

There are two solutions I can propose. 

1. Build your table filters as arbitrary field editors (outside the context of the table) that use the action framework to activate the filters.  See this forum post about filters on calendars where we explain the methodology:  https://community.skuidify.com/skuid/topics/filter-calendar-by-user-using-the-action-framework
In the action framework you can activate conditons on both the summary and detail record model. 

The downside to this is that you can't really reproduce table search control - that searches across multiple fields.   Sorry. 

2.   The secodn solution will be to write a custom component or listenener that picks up the Where statements in the query generated after you select some filter in the table and passes those conditions into the summary model.  The API's to do this sort of thing are available,  but plugging it together would be some work. 

Hope this is moderately successful. 
Photo of Nate Gilbertson

Nate Gilbertson

  • 1,194 Points 1k badge 2x thumb
Great! Thanks for providing some solutions and as always for your quick response.
(Edited)
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
No worries.  Thanks for being our customer. 
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
I was going to post about this as a new idea, but this is asking for what I want.

I think this should be an idea with the feature baked in. So, if the model has records loaded but is flagged as having more records, I'd like to see a secondary dynamically created agg model query to get the record count based on the current conditions of the table model.