How to show array content in dropdown list?

I want to present the content in an arry in a dropdown list.
But all I get is the predefined names "string1", "string2", "string3" and so on.

Answers

  • If you want it to grab data you retrieve somewhere, you can create the dropdown menu like this. You can use/adjust this code to make it work for you.

    const dataNames = [];

                if (regex) {
                    let match;
                    while ((match = regex.exec(content)) !== null) {
                        dataNames.push(match[1]);
                    }

                    console.log(`🔧 Gevonden ${dataLabel} namen:`, dataNames);
                } else {
                    console.warn("⚠️ Geen actieve knop gevonden. Kies een knop.");
                }

                const optionString = dataNames.length
                    ? [...new Set(dataNames)].map(name => `${name}|${name}`).join(";")
                    : `No ${dataLabel || "Data"} found|`;

                Instance.Select_WeldParametersData.optionItems = optionString;