Hide slide if dynamic content is empty

I have a slideshow set up to show different rooms in a hotel which is linked to a dynamic dataset.

I have 20 slides for not all hotels will have 20 different types of rooms so I am trying to hide the slide if there is no content.

I have been searching the forums all day but can’t find a solution that works.

I currently have this but its not working. Could anyone help me please as I have very little knowledge of coding in Wix.

$w ( “#dynamicDataset” ). onReady (() => {
var item = $w ( “#dynamicDataset” ). getCurrentItem ();
if ( item [ “text113” ] === undefined ) $w ( “#slide22” ). hide ();
else $w ( “#slide22” ). show () ;
});