Displaying Database Tags in a Repeater

I have collected them in the collection as Tags, from a checkbox group. (sounds familiar?)

These are the " selectionTags1"

Maybe there is some conflict with something?


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


var refFields = []
//--------- USER-INTERFACE ---------------------
var DATASET     = "#dataset1"
var DATABASE    = "DatosPerfil"
//-------------------------------
var REFERENCE1  = "actividad" 
var REFERENCE2  = "provincia" 
var REFERENCE3  = "colaborador"
//--------- USER-INTERFACE ---------------------
 
$w.onReady(async function () {
    refFields=[REFERENCE1, REFERENCE2, REFERENCE3]
 
 //Options for CheckBox-1--------------------------------------------------------------
    $w('#CB1').options = [
        {"label": "Embajadores",    "value": "Embajador"},
        {"label": "Embajadas",      "value": "Embajada"},
    ];

 //Create-Unique-Dropdown--------------------------------------------------------------
    wixData.query(DATABASE)
    .limit(1000)
    .find()
    .then(results => {
 const uniqueTitles1 = getUniqueTitles1(results.items);
 const uniqueTitles2 = getUniqueTitles2(results.items);
        $w("#DD1").options = buildOptions1(uniqueTitles1);  //---> ACTIVIDAD
        $w("#DD2").options = buildOptions2(uniqueTitles2);  //---> PROVINCIA
    });

 //Dropdown_Buttons--------------------------------------------------------------------
    $w('#DD1, #DD2').onChange(()=>{SEARCH_ENGINE();});
 //Checkbox_Buttons--------------------------------------------------------------------
    $w('#CB1').onChange(()=>{SEARCH_ENGINE();});
 //Search_Buttons----------------------------------------------------------------------
    $w('#BuscarBtn').onClick(()=>{ SEARCH_ENGINE(); });
 //Reset_Buttons-----------------------------------------------------------------------
    $w('#btnReset1').onClick(()=>{$w("#DD1").selectedIndex=undefined, SEARCH_ENGINE();});
    $w('#btnReset2').onClick(()=>{$w("#DD2").selectedIndex=undefined, SEARCH_ENGINE();});
})


//------------- Functions ------------------------------------------------------------
function getUniqueTitles1(items)    {const titlesOnly = items.map(item => item[refFields[0]]); return [...new Set(titlesOnly)];}
function buildOptions1(uniqueList1) {return uniqueList1.map(curr => {return {label:curr, value:curr};});}
//-------------
function getUniqueTitles2(items)    {const titlesOnly = items.map(item => item[refFields[1]]);  return [...new Set(titlesOnly)];}
function buildOptions2(uniqueList2) {return uniqueList2.map(curr => {return {label:curr, value:curr};});}
//-------------
 
function SEARCH_ENGINE() {console.log("Search-Engine started")
 let filter  = wixData.filter()  
 //DropDowns-------------------------------
 let item1   = $w('#DD1').value //---> DropDown
 let item2   = $w('#DD2').value //---> DropDown
 //Checkbox-Group--------------------------
 let item3   = $w('#CB1').value //---> CheckBox 

 //DropDowns-------------------------------
 if (item1!==undefined && item1!=="") {filter = filter.eq(REFERENCE1, item1)}
 if (item2!==undefined && item2!=="") {filter = filter.eq(REFERENCE2, item2)}
 //Checkbox-Group--------------------------
 if (item3!==undefined && item3!=="")  {
 for (var i = 0; i < item3.length; i++) {filter = filter.eq(REFERENCE3, item3[i])}
  }
  $w(DATASET).setFilter(filter)
  .then(()=>{
      result_COUNTER()
      $w('#table1').refresh();
  })
}
 
function RESET (parameter) {
    $w("#DD1").selectedIndex = undefined;
    $w("#DD2").selectedIndex = undefined;
    $w('#CB1').value = undefined;
}

//Result-Counter----------------------------------------------
function result_COUNTER() {
 let count = $w(DATASET).getTotalCount().toString();
    console.log("COUNT = " + count)
    $w('#resultCounter').text = count.toString()
} 

///SearchBar

///EMAIL BTN

/**
 *  Adds an event handler that runs when the element is clicked.
 *   @param {$w.MouseEvent} event
 */
export function btnemail_click(event) {
    wixLocation.to("mailto:") + $w('#dataset1').getCurrentItem().emailDeContacto.id
}

//HIDE ITEMS
$w.onReady(() => {
    $w("#dataset1").onReady(() => {
 // Gets the current item properties and stores them in a variable called item
 const item = $w("#dataset1").getCurrentItem();
 // Checks if the current item has a value in the "video" field
 if (!item.fbEmpresa) {
            $w("#FBimage").hide();
        }
 if (!item.instagramEmpresa) {
            $w("#INSTempresa").hide();
        }
 if (!item.youtubeEmpresa) {
            $w("#YTempresa").hide();
        }
 if (!item.twitter) {
            $w("#TWempresa").hide();
        }
 if (!item.LINPersonal) {
            $w("#LINKPersonal").hide();
        }
 if (!item.linEmpresa) {
            $w("#LINEmpresa").hide();
        }
 if (!item.iniciativa) {
            $w("#group1").collapse();
        }
 if (!item.URL) {
            $w("#web").collapse();
        }
    });
});


export function repeater1_itemReady($item, itemData, index){
 let options = [];
 let tags = itemData.tipoActividad;

   console.log("Item-Data: ", itemData)
   console.log("Index: ", index)
   console.log("Tags: ", tags)

 for(var i =0; i < tags.length; i++){        
       options.push({"label": tags[i],"value": tags[i]})
 if(i===tags.length){$item("#selectionTags1").options = options;}
   }
}