Updating Database value

I’ve created a repetear with different reviews from my users. Now I want people to be able to like the comments made by others and I want to count the likes saved in my database row called ‘likes’. I can already succesfully identify when the like button (‘#Like’) is being clicked, take the initial count and add 1. However, I can’t update the new value in my database.

If anyone could help I’d be grateful, here is my function code:

export function dataset1_ready() {
likeComment();
}

export function likeComment () {
$w(“#repeater1”).forEachItem( ($item, itemData, index) => {

    $item("#Like").onClick( (event) => { 

let likeCnt = itemData.likes;
let newLikeCnt = likeCnt + 1;
$w(“#dataset1”).setFieldValue(‘likes’, newLikeCnt) //not working
$w(“#dataset1”).save(); //not working
});
});
}

It suspect that you also need to use $item for the following lines so that the Repeater item refers to the correct dataset item.

$item("#dataset1").setFieldValue('likes', newLikeCnt) ;
$item("#dataset1").save();

Thank you!!

Do you know why when I click a button I have in the page, to load more comments in the repeater, the function doesn’t work for the new elements loaded in the repeater?

Hi, please I need your help. I have a form that when filled by my site member populates a database. The content of the database is displayed for each member on their profile based of what the filled in the form.

The problem is:
I have a number that is displayed on the member’s profile(also filled by the member while filling the form and stored in the database), I have a code that changes the value of the number on the member’s page but I am not able to update the number in the database and save it with the new value so that when the member logs-in again, the new value is displayed and can also be updated in the future. How do I do it? Thanks