Show only ticked tag elements from the Database

Hey Wixers,
I am so hard looing for a solution for : People are checking what they offer in checkboxgroup those values get saved in the database when i display them it also show me the ones that are not ticked but i want only to display the ones that have been ticked


Ass you can see the following code tells me map undefined but i tried everything no solution yet

import wixData from ‘wix-data’ ;

export function dynamicDataset_ready() {
let item = $w( “#dynamicDataset” ).getCurrentItem;
// substitute your field name storing the tags
let chosenValues = item.wellness;
let newOptions = buildOptions(chosenValues);
$w( “#checkboxGroup5” ).options = newOptions;
// if you want them all checked?
let indices = buildSelectedIndices(chosenValues);
$w( “#checkboxGroup5” ).selectedIndices = indices;
}

function buildOptions(chosenValues) {
return chosenValues.map((curr) => {
return { label: curr.toString(), value: curr };
});
}

function buildSelectedIndices(chosenValues) {
let selIndices = ;
for ( var i = 0 ; i < chosenValues.length; i++) {
selIndices.push(i);
}
return selIndices;
}

import wixData from ‘wix-data’ ;

$w.onReady( function dynamicDataset_ready () {
$w( “#dynamicDataset” ).onReady(() => {
let item = $w( “#dynamicDataset” ).getCurrentItem;
// substitute your field name storing the tags
let chosenValues = item.klimatisierung;
let newOptions = buildOptions(chosenValues);
$w( “#checkboxGroup3” ).options = newOptions;
// if you want them all checked?
let indices = buildSelectedIndices(chosenValues);
$w( “#checkboxGroup3” ).selectedIndices = indices;
});
});

function buildOptions(chosenValues) {
return chosenValues.map((curr) => {
return { label: curr.toString(), value: curr };
});
}

function buildSelectedIndices(chosenValues) {
let selIndices = ;
for ( var i = 0 ; i < chosenValues.length; i++) {
selIndices.push(i);
}
return selIndices;
}

export function dynamicDataset_ready() {
// This function was added from the Properties & Events panel. To learn more, visit Velo: Working with the Properties & Events Panel | Help Center | Wix.com
// Add your code for this event here:
}

I have also tried this