Thanks man! A real Ninja! ![]()
Yes it has a much better structure, of course. I like this, my problem is always, that i forget about this option and use simple if-else-queries.
But i have some another end-solution, also not a bad one, i just did not show it here yet, but here it is…
export async function btnAddList_click(AUSWAHL) {
let myArray0 = ["field1", "field2", "field3", "field4", "field5", "field6", "field7", "field8", "field9", "field10"]
let myArray1 = []
let myArray2 = []
if (state===undefined) {
$w('#boxSelection').show('float')
$w('#btnTitle').label = settingsDATA["setup1"]
}
else {console.log("Auswahl bereits getätigt.")
for (let index = 0; index < $w('#cbgListCopy').value.length; index++) {
if($w('#cbgListCopy').value[index]!==undefined) {
myArray1.push($w('#cbgListCopy').value[index])
myArray2.push(copyDATA[$w('#cbgListCopy').value[index]])
if(index=0){
myFilter = {[myArray0[0]]: myArray2[0]}
}
if(index=1){
myFilter = {[myArray0[0]]: myArray2[0], [myArray0[1]]: myArray2[1]}
}
if(index=2){
myFilter = {[myArray0[0]]: myArray2[0], [myArray0[1]]: myArray2[1], [myArray0[2]]: myArray2[2]}
}
if(index=3){
myFilter = {[myArray0[0]]: myArray2[0], [myArray0[1]]: myArray2[1], [myArray0[2]]: myArray2[2], [myArray0[3]]: myArray2[3]}
}
if(index=4){
myFilter = {[myArray0[0]]: myArray2[0], [myArray0[1]]: myArray2[1], [myArray0[2]]: myArray2[2], [myArray0[3]]: myArray2[3], [myArray0[4]]: myArray2[4]}
}
if(index=5){
myFilter = {[myArray0[0]]: myArray2[0], [myArray0[1]]: myArray2[1], [myArray0[2]]: myArray2[2], [myArray0[3]]: myArray2[3], [myArray0[4]]: myArray2[4], [myArray0[5]]: myArray2[5]}
}
}
}
else {console.log("Value-0 = undefined")}
FILTER.push(myFilter)
console.log("FILTER = ", FILTER)
local.setItem("copyData", JSON.stringify(FILTER))
console.log("FILTER = ", FILTER)
$w('#btnAddList').enable()
if ($w('#cbgListCopy').value.length>0) {$w('#btnShowList').enable()}
}
}
But, you are right, the case-break-option seems to be a little bit more comfortable.![]()
Thanks for advise.