Pressing an Instagram like button multiple times

Hello, I’m new to Adalo and I’m developing a survey application for a client.

To explain my problem, I take the example of the Instagram application: how can a user press the “like” button several times by counting the number of presses?

I created a relationship “one user to several likes” and “many likes to several users”, but that only counts 1 like for each press on the button, I like.

In summary, I would like: - a user to be able to press a ‘‘like’’ button several times, causing the counter to go from “1 like” to “12,14… likes” on the same post. - In my database, I want to be able to see which user and how many times the current user pressed the “like” button.

You need a numeric field in the ‘Posts’ collection, call it ‘LikesCount’
Every time the button is pressed + 1, everytime it is unpressed -1.

You could use a toggle button with like / dislike icon, attach the update ‘Post’ Action to the additional Actions section in the toggle menu.

I don’t think you need two relationships, just many to many or a JOIN table. Search the forum for info on JOIN tables.


Thanks for the quick response, but with the Adalo price update, the number of shares is taken into account and it’s not worth the cost just for a counter that will make updates in the collection with each like.

1 Like

hi @Jonathan10,

I think it’s simpler than it seems. Rozza has it right. I recreated the case and I’m on the free plan, check it out: (7)

here’s a cloneable link to see how it’s built.

To make this work:

  1. create a data collection (likes) this is where you keep record of each user’s likes count for a particular post.
  2. add an icon that should be the trigger when the logged in user hasn’t liked this post yet.
  3. make it visible only when current posts > likes > users does not contain logged in user.
  4. when clicked, it CREATEs a like where the user is the current user, post is current post and count is 1.
  5. create an icon that shows when user has liked post at least once, put the count beside it and make it a list of likes (current posts likes > user email = logged in user email) this will only have one result at any point in time, so don’t worry about it being a list. But we need a list to be able to increase the count.
  6. when clicked, current likes count is increased by 1.
1 Like

Thanks, that’s exactly what I was looking for for the survey. This method requires a data update and Adalo counts updates as additional actions performed by end users. My package is in danger of exploding.

1 Like

Oh I get you. If only there was a way to store info to a component temporarily (session based) and then update it with the total count just once…maybe someday.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.