Feb 13, 2023 09:46 PM
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.
Solved! Go to Solution.
Feb 13, 2023 10:18 PM
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).**`);
Feb 13, 2023 10:18 PM
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).**`);
Feb 14, 2023 04:19 AM - edited Feb 14, 2023 07:37 AM
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))
Feb 14, 2023 09:41 PM
Well, I am glad to have inspired someone. 👍