Help

Re: Getting record count in Gallery view after filtering

Solved
Jump to Solution
2484 0
cancel
Showing results for 
Search instead for 
Did you mean: 
VineetK3
5 - Automation Enthusiast
5 - Automation Enthusiast

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.

1 Solution

Accepted Solutions
VineetK3
5 - Automation Enthusiast
5 - Automation Enthusiast

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).**`);

See Solution in Thread

3 Replies 3
VineetK3
5 - Automation Enthusiast
5 - Automation Enthusiast

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))

 

Well, I am glad to have inspired someone. 👍