Help

Re: Record counter for website?

421 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Deko
7 - App Architect
7 - App Architect

I would like to display the number of records that I have in a table on my website. I know I can do this manually, but I would have to keep updating it manually and was wondering if there was an automated way.

For example:

“567 products and counting!”

Where the number 567 is the number of records (rows) in the table that updates automatically when records are added.

Is this possible with javascript or something?

2 Replies 2

Hi @Deko - yes, you can use the Airtable API to get the records from a table and then count them up. The data returned is an array, so array.length will give you the count.

You could do this with client-side Javascript, but this isn’t recommended for a public website. In this case the call to the API would be made from the user’s browser and this would mean exposing you API key in the visible source code - easy for anyone with a bit of technical knowledge to find. A better way would be to do this server side in whatever programming language your website is written in - very similar code, but the call happens on the server and the API key is not exposed in the page source.

Deko
7 - App Architect
7 - App Architect

Yea…I don’t know how to use API or anything. Manual updates it is.