Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Set Dropdown Menu values with expressions

Participant ,
Sep 06, 2021 Sep 06, 2021

Is it possible to set a Dropdown Menu Item Value with an expression? I tried

 

effect("TestLayer")("Menu")(1).value = "Test"

effect("TestLayer")("Menu").item(1).value = "Test"

effect("TestLayer")("Menu").item(1).setValue("Test")

 

But nothing seems to work...

TOPICS
Expressions
839
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Mentor , Sep 06, 2021 Sep 06, 2021

You cannot set the items of the dropdown with an expression.

 

*Martin

Translate
LEGEND ,
Sep 06, 2021 Sep 06, 2021

The dropdown only returns an index or an UI string from the custom list. The actual magic has to happen inside your expression by e.g. associating the index with an array value or whatever. Expressions have no way to hard-set an external reference, so what you seem to have in mind won't work, anyway. You have to include all references in your expression and then pick the one you want to process via your code.

 

Mylenium

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 06, 2021 Sep 06, 2021

Thanks Mylenium. I think I used the wrong syntax for my description. What I'm actually looking for is a way to fill the descriptive names of the items - I know, that the "values" are actually the indeces, thats fine.

 

So, as example, this is what I'm looking for:

 

Dropdown 1 lists "Theme 1", "Theme 2" and "Theme 3" (static elements)

Dropdown 2 should be dynamic. So, in pseudocode:

 

if(Dropdown 1 == "Theme 1")

{

Dropdown 2.item(1).text = "Theme 1 Item 1";

Dropdown 2.item(2)...

}

else if(Dropdown 1 == "Theme 2"){

Dropdown 2.item(1).text = "Theme 2 Item 1";

Dropdown 2.item(2)...

}

else if(Dropdown 1 == "Theme 3"){

Dropdown 2.item(1).text = "Theme 3 Item 1";

Dropdown 2.item(2)...

}

 

So what I'm actually looking for is a way to rename or create items of a given dropdown menu.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Sep 06, 2021 Sep 06, 2021

You cannot set the items of the dropdown with an expression.

 

*Martin

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 06, 2021 Sep 06, 2021
LATEST

I was afraid so, but hoped for it 😉 Thanks for the confirmation though.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines