Hello Lee,
first at all thanks for your time and your interest to help me.
I try to explain a little bit more.
This is my Code:
for (var i = 0; i < Gefundeneitems.length; i++) {
var selectedItem
//Konvertierung/Zuordnung (ITEM)
if (Datenbank == "Waffen") {selectedItem = Gefundeneitems[i].waffe, AusgewähltesItem = Gefundeneitems[AusgewählterItemIndex].waffe}
else if (Datenbank == "Rustungen") {selectedItem = Gefundeneitems[i].rustung, AusgewähltesItem = Gefundeneitems[AusgewählterItemIndex].rustung}
else if (Datenbank == "Schilder") {selectedItem = Gefundeneitems[i].schild, AusgewähltesItem = Gefundeneitems[AusgewählterItemIndex].schild}
else if (Datenbank == "Geiststeine") {selectedItem = Gefundeneitems[i].geiststeine, AusgewähltesItem = Gefundeneitems[AusgewählterItemIndex].geiststeine}
else {$w("#DDgegenstand").options = [{label:""}], $w("#DDgegenstand").disable()}
// BildUrl= Gefundeneitems[i].bildUrl
//Beschreiben des DropDown-Menüs für Gegenstände
let opts = $w("#DDgegenstand").options;
opts.push({"label": selectedItem, "value": selectedItem});
$w("#DDgegenstand").options = opts;
}
The endings —> (waffe/rustung/schild/geiststeine) are colums in different data-collections. The Data-collections are called (Waffen/Rustungen/Schilder/Geiststeine).
So i have 4 data-collections with one colum inside each data-collection wich are called (waffe/rustung/schild/geiststeine)
I do not want the “IF-STATEMENT”.
I want to solve it like this (just in one line of Code…
let xxx = "waffe" (or "rustung" or "schild")
Gefundeneitems[AusgewählterItemIndex].xxx
I want the “xxx” as a variable, wich is declared on an other place of code.
But if i write the syntax like that, it does not work.
So my question is, how to write it in a right way (right syntax).
Or what else is additional to do, to solve my problem.
P.S.: This is the other code, which already defines the “xxx”-variable…
if ($w('#DD4').value == "Waffen"){Datenbank="Waffen", xxx="waffe"
if ($w('#DD3').value == "Sonstiges"){$w("#DDgegenstand").disable(), deaktiviereAlleDropdows(), $w('#DD3').style.backgroundColor = '#FF6161', $w('#DD4').style.backgroundColor = '#FF6161'}//--->rot
else {$w("#DDgegenstand").enable()}
}
//--------------------------------------------
else if ($w('#DD4').value == "Rüstungen"){Datenbank="Rustungen", xxx="rustung"
if ($w('#DD3').value == "Sonstiges"){$w("#DDgegenstand").disable(), $w('#DD3').style.backgroundColor = '#FF6161'}//---> rot
else {$w("#DDgegenstand").enable()}
}
//--------------------------------------------
else if ($w('#DD4').value == "Schilder"){Datenbank="Schilder", xxx="schild"
if ($w('#DD3').value == "Sonstiges"){$w("#DDgegenstand").disable(), $w('#DD3').style.backgroundColor = '#FF6161'}//---> rot
else {$w("#DDgegenstand").enable()}
}
//--------------------------------------------
else if ($w('#DD4').value == "Geiststeine"){Datenbank="Geiststeine", xxx="geiststeine"
deaktiviereAlleDropdows()
deaktiviere_Switchbuttons()
if ($w('#DD3').value == "Sonstiges"){
$w('#DD3').style.backgroundColor = '#6BFF8B'//---> grün
$w('#DD4').style.backgroundColor = '#6BFF8B'//---> grün
$w("#DDgegenstand").enable()
}
else {$w("#DDgegenstand").disable(), $w('#DDgegenstand').style.backgroundColor = '#FF6161', $w('#DD3').style.backgroundColor = '#FF6161', $w('#DD4').style.backgroundColor = '#FF6161'}//---> rot}
}
else {Datenbank = "Dieser Item-Typ ist noch nicht definiert und somit nicht vorhanden, bitte legen Sie hierfür eine Datenbank an.", $w("#DDgegenstand").options = [{label:""}], $w("#DDgegenstand").value=0, $w("#DDgegenstand").disable()}
Sorry, i had to correct something, i have edited the post.
Thanks for HELP!