[Solved] Image icon/tag showing although dataset field is empty

stcroppe,
the last code works perfectly for the repeater, thank you so much for taking the time!
However ‘button4’ is still showing regardless of ‘document’ field being empty or not. I tried both the above suggested code and this (same syntax throughout):

$w.onReady(() => {
    $w("#repeater1").onItemReady( ($w, itemData, index) => {
        console.log(itemData.image2);
 if(itemData.image2 && itemData.image2.length > 0) {
 // We have an image assign it to the element for display
            $w("#image25").src = itemData.image2;
            $w("#image25").show();
        } else {
            $w("#image25").src = ''; // No Image - do not use null
            $w("#image25").hide();
        }
        console.log(itemData.image3);
 if(itemData.image3 && itemData.image3.length > 0) {
 // We have an image assign it to the element for display
            $w("#image24").src = itemData.image3;
            $w("#image24").show();
        } else {
            $w("#image24").src = ''; // No Image - do not use null
            $w("#image24").hide();
        }
     });
     $w("#dynamicDataset").onReady( ($w, itemData, index) => {
         console.log(itemData.document);
 if(itemData.document && itemData.document.length > 0) {
          $w("#button4").src = itemData.document;
            $w("#button4").show();
        } else {
            $w("#button4").src = ''; 
            $w("#button4").hide();
         }
     });
  });

Is it because the field is called ‘Document’ that I get issues? Or because I’m using the code written for a repeater on the dynamic dataset as a whole?