Display databases document field name in the repeater

I set up a repeater and a database to display announcements on a website. I have everything figured out except for the documents in the database. I would like to be able to display the file name of the document the repeater pulls from the database. Also I would like to hide the button or whatever element I need to use to display this if the document field in the database is blank. I’ve been looking into this for hours and haven’t found anything that’s worked.

So here’s everything I’m trying to accomplish:

  1. Display file name from document field in database in a repeater.
  2. Make it clickable where it actually takes you to the document.
  3. If the document field is blank collapse the element in the repeater.

Attached is a picture of what it looks like on their old website.

So I got the 2 of the 3 things working. Using the below code I was able to get the description element and the attachment button to collapse if the corresponding fields in the database are empty. I got the URL portion working by linking the button to the document field in the database. Now all I’m missing is changing the button label to the file name from the document field in the database.

I’ve dug into this article ( https://www.wix.com/corvid/forum/community-discussion/showing-file-names-in-repeater-buttons ) but haven’t been able to get it to work.

$w.onReady(function () {
    $w("#dataset2").onReady ( () => {
$w("#repeaterAnnouncements").onItemReady(($w, itemData, index) =>{
 if (!itemData.repeater_description) {
                $w("#repeaterDescription").collapse();  
        }
 if (!itemData.repeater_file1) { 
                $w("#attachement1").collapse(); 
        }       
});
}); 
});