Is there any way to bind int field in some table to relations amount?

For example, I have a simple table with 2 fields. One fields is (int) Likes, the second field is (Relation to Users) Liked.

I want the field always to have a value equals the amount of Liked relations. If there is 3 relations for 3 different Users, it has to be ‘3’ number in Likes field. How I can do it? Only with the API feature?


There’s no built-in way to do this, but you could set up an event handler which would update the field by retrieving the count of related objects and saving it.