Hide displayed tags if database is empty

Here is what i use to hide/collapse information that comes from a data set but some items may not have them i want them hid,



// collapse code for Promo starts here
$w.onReady(() => {
    $w("#dynamicDataset").onReady(() => {
  // Gets the current item properties and stores them in a variable called item
        const item = $w("#dynamicDataset").getCurrentItem();
        // Checks if the current item has a value in the "Promo" field
        if (!item.promo) {
        // Collapses the image if there is no value for "Promo" field
            $w("#text58").collapse();
        }
    });
});
// collapse code for Promo finishes here

Hope this helps