Make airtable data available for javascript code

Hello everyone, i have a list of data that i get from airtable using built-in softr table block, i want to use this data to do some calculations with javascript custom-code, but i didn’t know where to get this data from.
Can anyone help?

1 Like

Hello @Med-Oks,
could you please provide more details so I can help. I need the mapped and published table and also what should be calculated?

I just need a way to be able to use displayed table data inside javascript in general.

Ok, to get the displayed records you will need to listen to a custom event bellow that is triggered on every data response from Softr data service. It can be used for getting the data and using it. You will need to get values using selectors for your specific field.

<script>
	const onRecords = (e) => {
		setTimeout(() => {
			// The block finished rendering 
			// You may do some staff here.
		}, 50);
         };
	
	window.addEventListener('get-records-table1', onRecords);
</script>

Exactly what i was looking for, thank you so much!

1 Like

Hi @Astghik! Do you have any documentation or examples on how to build the selectors for the specific fields?

Should I use the data-field-id?

I’m trying that but I can’t get it to work

Hi @funkycoldmedina, we don’t have any documentation for that and it depends on the specific field type. But I’m here to help. You can specify the fields and block and I can provide a corresponding code. You can provide your app URL or feel free to DM me and we will make it work for you.

1 Like

You’re the best! I’ll send you a DM. Thank you!

1 Like