Hide Strip if a field is empty in a dataset

Still unclear, if your code is located on a dynamic , or a non-dynamic page ?

What do we know already?

  1. DATASET --------> “prodottiDataset”
  2. DATABASE ------> “Prodotti”
  3. REFERENCE1 → “Finiture”
  4. REFERENCE2 → “galleriaProdotto”
  5. STRIP1 ------------> “finiture”
  6. STRIP2 ------------> “stripDettagli”

Further, when working with datasets, your datasets should always first be ready, before working with them.

$w.onReady(function() {
   $w(DATASET).onReady(()=>{
      // your code here....
   });
});

If you are using a —> DYNAMIC page, where you only can show an item at once…

import wixData from 'wix-data';
import wixLocation from 'wix-location';

const DATASET = '#prodottiDataset'
const DATABASE = 'Prodotti'
const REFERENCE1 = 'Finiture'
const REFERENCE2 = 'galleriaProdotto'
const STRIP1 = '#finiture'
const STRIP2 = '#stripDettagli'

$w.onReady(async function () {
   $w(DATASET).onReady(()=>{
      //$w(DATASET).setFilter(wixData.filter().eq('storeProducts', product._id));
      let finiture = $w(DATASET).getCurrentItem().finiture;
      let gallery =  $w(DATASET).getCurrentItem().galleriaProdotto; 
      
      if (finiture) {$w(STRIP1).expand();} else {$w(STRIP1).collapse();}
      if (gallery)  {$w(STRIP2).expand();} else {$w(STRIP2).collapse();}
   });
});

If you entered your dynamic page and starts to switch items, your 2x STRIPS will appear or disappear, related to their values connected to the related DATASET.