Click all button in repeater with 1 click [SOLVED]

I have a Repeater inside which I have a button to add the items inside the repeater to a Database.

I have added an Afterinsert hook to my Database so that whenever a new row is inserted, an email is triggered to the email in the row. This email contains a link to a survey.

However, sometimes there are lots of items in the repeater and i have to go on clicking each row’s button for like 30-40 times.

Is there any way where with 1 click all the items in the repeater gets inserted into the Database so that the after insert hook is called for each of them and the emails are sent ?

Would really appreciate some guidance

Hi,
Can you share your code so we can try to direct to the right direction?
Roi.

Hey Roi,

Yisrael helped me with this. All good.

This was the code:

export async function send_click(event, $w) {
   $w("#done").show();
 let count = $w("#dataset1").getTotalCount();
 let results = await $w("#dataset1").getItems(0, count);
 let items = results.items;
 for(var i = 0; i < count; i++) {
 const res = await wixData.insert("SurveysSent", items[i]);
   }     
   $w("#done").hide();
   $w("#done1").show();
}