Set random number to database collection items

That worked mate thx. Now I’m trying to save this numbers to my database items.

export function kontrol() {
    $w("#dataset1").onReady(() => {
        $w('#repeater1').onItemReady(($item, itemData, index) => {
            if (itemData.ilanNumarasi !== '') {
                console.log('Boş')
                var ilanNo = String(parseInt(Math.random() * (1000 + 1)))
                $item("#text50").text = ilanNo;
            }
            $w("#dataset1").setFieldValue('ilanNumarasi', ilanNo)
        })
       
    })
     $w("#dataset1").save();
}