The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.
Aug 19, 2021 05:57 AM
Goal: Send a daily email using airtable app triggered by time, linked to a view. The problem is airtable limits the count to 100 records and these views contain more than 100 records.
I need a script that counts the number of records in a view. Thats it. I’ve searched the forums but have not been successful at figuring this out. Any help would be greatly appreciated.
Aug 19, 2021 07:01 AM
Welcome to the Airtable community!
const table = base.getTable("Table 1")
const view = table.getView("My View")
const queryResult = await view.selectRecordsAsync({fields: []})
const numRecordsInView = queryResult.records.length
console.log(numRecordsInView )
Aug 19, 2021 07:22 AM
Awesome! This worked however when i try to reference it in the email automation i get the following error:
“This action does not have any output”. It wont let me insert it in the html.
Aug 19, 2021 07:55 AM
You need to set the output to use it in an future automation step.
Aug 19, 2021 10:13 AM
That worked Perfectly! Thank you for your help.
Oct 12, 2021 07:50 PM
Can you explain how you got the output to work? I have 1000 records in a view and would like to get an email every time this view reaches this threshold.
I copied the script but can get the output to work? Any ideas.
Oct 12, 2021 08:10 PM
Setup a view on your table and get that part setup so that it shows the data exactly the way you want it.
Create a trigger (everyday at this time do this).
Then run a script. Here is an example of mine.
const table = base.getTable(“Dynamic Builder Report”)
const view = table.getView(“Team - Backlog”)
const queryResult = await view.selectRecordsAsync({fields: })
const numRecordsInView = queryResult.records.length
console.log(numRecordsInView )
output.set(‘Team Count’, numRecordsInView);
Then on your email message, plug in that info.
Oct 13, 2021 06:45 PM
Thank you so much! Worked like a charm. That was the missing piece.
Oct 13, 2021 07:05 PM
this is filler, i used the reply to email feature and my firm stuffed a bunch of legal text in my signature. Wasnt expecting it.
Oct 13, 2021 07:27 PM