Showing hidden elements based on having something in a field within a dataset

Please post your code in a code block as it is very difficult to deal with in a screenshot.

Line 11 has an error on the onReady() function since it is “outside” of the page $w.onReady() function and therefore inaccessible. See $w.onReady() :: a guide for the perplexed to better understand what the page onReady() function does and what it’s for.

Furthermore, it is incorrect to define more than one dataset onReady() function. It is defined once, in the page’s onReady() to ensure that the dataset is ready before trying to use it.

What is it you are trying to accomplish?

Perhaps this is sort of what you need:

$w.onReady(function () {
   $w('#newsDataset').onReady(() => {
      let item = $w('#newsDataset').getCurrentItem();
      if(item.pdf !== undefined || item.pdf !== null) {
         $w('#pdfDownload').show();
      }
      if(item.audio !== undefined || item.audio !== null) {
         $w('#audioDownload').show();
      }
   } 
}

Disclaimer: This has not been tested, but it’s sort of close to what I understand that you are trying to do.