Skip to main content
Solved

Getting record count in Gallery view after filtering

  • February 14, 2023
  • 3 replies
  • 75 views

Forum|alt.badge.img+2

So I found no way to get the total record count when I am in Gallery view. I would especially like to get the count once I have applied any filter.

In the "Full View" the status bar at the bottom does show total count. It also updates when a filter is applied. I would want a similar way to get the count but in Gallery view. The Full view have an additional nice way to get count when Grouping is applied. But in the Gallery view we can't even apply any grouping.

Any solution welcome, even if it needs Scripting.

Best answer by VineetK3

Ok, so I found the script using which I can get the count. Still it would be good of Airtable count show the count of records in Gallery view, just like it shows in Full view.

For the record, here is the code that I used to get the record count in Gallery view:

let config = input.config({ title: 'Fetch Total Record Count', description: 'This is a script to fetch total record count.' }); let table = base.getTable('Imported table'); let view = table.getView('Gallery') const queryTableResult = await table.selectRecordsAsync({fields: []}); const queryViewResult = await view.selectRecordsAsync({fields: []}); const recordCount = queryTableResult.records.length; const recordViewCount = queryViewResult.records.length; output.markdown(`**Table has ${recordCount} record(s).**`); output.markdown(`**Gallery view has ${recordViewCount} record(s).**`);

3 replies

Forum|alt.badge.img+2
  • Author
  • New Participant
  • Answer
  • February 14, 2023

Ok, so I found the script using which I can get the count. Still it would be good of Airtable count show the count of records in Gallery view, just like it shows in Full view.

For the record, here is the code that I used to get the record count in Gallery view:

let config = input.config({ title: 'Fetch Total Record Count', description: 'This is a script to fetch total record count.' }); let table = base.getTable('Imported table'); let view = table.getView('Gallery') const queryTableResult = await table.selectRecordsAsync({fields: []}); const queryViewResult = await view.selectRecordsAsync({fields: []}); const recordCount = queryTableResult.records.length; const recordViewCount = queryViewResult.records.length; output.markdown(`**Table has ${recordCount} record(s).**`); output.markdown(`**Gallery view has ${recordViewCount} record(s).**`);

Alexey_Gusev
Forum|alt.badge.img+25
  • Brainy
  • February 14, 2023

Ok, so I found the script using which I can get the count. Still it would be good of Airtable count show the count of records in Gallery view, just like it shows in Full view.

For the record, here is the code that I used to get the record count in Gallery view:

let config = input.config({ title: 'Fetch Total Record Count', description: 'This is a script to fetch total record count.' }); let table = base.getTable('Imported table'); let view = table.getView('Gallery') const queryTableResult = await table.selectRecordsAsync({fields: []}); const queryViewResult = await view.selectRecordsAsync({fields: []}); const recordCount = queryTableResult.records.length; const recordViewCount = queryViewResult.records.length; output.markdown(`**Table has ${recordCount} record(s).**`); output.markdown(`**Gallery view has ${recordViewCount} record(s).**`);

Hi,

you question inspired me to edit my fields 'oneliner' to show a number of current view records

 

await base.getTable(cursor.activeTableId||'').getView(cursor.activeViewId||'').selectRecordsAsync({fields:[]}).then(q=>console.log(q.records.length))

 


Forum|alt.badge.img+2
  • Author
  • New Participant
  • February 15, 2023

Hi,

you question inspired me to edit my fields 'oneliner' to show a number of current view records

 

await base.getTable(cursor.activeTableId||'').getView(cursor.activeViewId||'').selectRecordsAsync({fields:[]}).then(q=>console.log(q.records.length))

 


Well, I am glad to have inspired someone. 👍