why $w('repeater1).data is not working

I am displaying dynamic events content. But onReady I want to truncate the event descriptions and display the modified events list. Though I managed to slice the content, the repeater is not showing the new array, it still shows the data directly from the database, which indicates my new modified data array is not getting attached to the repeater or I am wrong with my onReady. Can somebody help me here a bit, please?

$w.onReady(function () {
    $w("#dynamicDataset").onReady(function (){
        let totalCount = $w("#dynamicDataset").getTotalCount()
        $w("#dynamicDataset").getItems(0, totalCount)
        .then( (results) => {
               for(let i=0; i<results.items.length; i++){
               if(results.items[i].eventDescription.length > 50)
                results.items[i].eventDescription = results.items[i].eventDescription.slice(0, 100) ;    
        }
        let resultsWithSnippet = results.items;
        console.log(resultsWithSnippet) // this shows the array with sliced description
        $w('#repeater1').data = resultsWithSnippet; //this is not working
     })
        .catch((err) => {
        let errorMsg = err;
        })
 })

Also, which is a better idea? While saving the data to the database, create snippet field and save the snippet or while displaying in the dynamic page, modify the array and display it.

You are correct, this won’t work:

$w('#repeater1').data = resultsWithSnippet; //this is not working

The reason is that the Repeater is already connected to the dynamic dataset which sets the contents of the Repeater.

What you want to do is to use the Repeater’s onItemReady() function to “truncate the event descriptions” and do whatever else you want to do to the information to be displayed in the Repeater. Depending on your use, you might consider the forEachItem() function.

Thank you so much Yisrael. Okay will check that out.