Dropdown depends of another droppdown

Dropdown depends of another droppdown

  

Hi,

I'm working with Outsystems 10 on a Mobile app. I want the options on a dropdown to depend on the option selected on a previous dropdown. But I don't know how to do it...

Example: 

dropdown 1 options: {animals, fruits}


dropdown 2 options:

{cat,dog} If dropdown 1 = animals

{apple,banana} If dropdown 1 = fruits


I have a list of all the possible dropdown options combinations like:

Option1,Option2:

animals,cat

animals,dog

fruits,apple

fruits,banana


Right now I can only list in dropdown2 all the possibilities, I cannot make it depending on the 1st... Can somebody please help me?

Solution

Hi Clara,

You can set an Client Action on the OnChange property of the first dropdown.

Then in that Client Action you do:

  • if the data of the second dropdown comes from a variable then you recompute the list for that variable
  • If the data of the second dropdown comes from an aggregate (or data action) you just refresh the aggregate (using the Refresh Data statement). In this case the aggregate should be filtered in a way to get the values that relate to the variable of the first dropdown.

Does this makes sense?

Cheers,

José

Solution

It worked! I have the second case.

Obrigada José. 


José Costa wrote:

Hi Clara,

You can set an Client Action on the OnChange property of the first dropdown.

Then in that Client Action you do:

  • if the data of the second dropdown comes from a variable then you recompute the list for that variable
  • If the data of the second dropdown comes from an aggregate (or data action) you just refresh the aggregate (using the Refresh Data statement). In this case the aggregate should be filtered in a way to get the values that relate to the variable of the first dropdown.

Does this makes sense?

Cheers,

José