Select an item from the drop down and display its description in an expression

Hello Guys,

I am trying to select an item from a drop down(Value_Names) and display its description(Value_Description) in an expression in a form,but I'm unable to do that...I need help peeps.

Regards 

Siseko

Hi Siseko,

Can you explain in more detail what you already tried to do? What does "unable to do that" mean in this context, is there something specific you don't know how to do?

Kilian Hekhuis wrote:

Hi Siseko,

Can you explain in more detail what you already tried to do? What does "unable to do that" mean in this context, is there something specific you don't know how to do?

When I select an item from a drop down,I want to automatically display the description of that item in an expression...all this information I want to display is from the excel file.

 


Hi Siseko,

You can set an On Change handler for the drop down, then retrieve the description and Ajax Refresh the Expression. This is al pretty basic OutSystems stuff, so if you don't know how to do that, you might want to revisit the training material...

I attached a OML file. What you need is a combobox to display the list of options and then the source to populate the combo box (I used static entity), then create an onchange action with an ajax refresh to refresh the container witgh if statements.



Nicholas Belo wrote:

I attached a OML file. What you need is a combobox to display the list of options and then the source to populate the combo box (I used static entity), then create an onchange action with an ajax refresh to refresh the container witgh if statements.



Hi Nicholas Belo!


you can use this:


 Instead of:


Because your SelectedAnimal already have the Id of selected animal

Thanks and Best Regards,

Nuno Pereira


Nicholas Belo wrote:

I attached a OML file. What you need is a combobox to display the list of options and then the source to populate the combo box (I used static entity), then create an onchange action with an ajax refresh to refresh the container witgh if statements.




Hi Nicholas,

Thank you very much,this is clear and helpful.I understood everything in your code.So,Is there a way you can do this using an entity but not static entity?

Kind Regards

Siseko

Solution

Hi Siseko,

The code that Nicholas offered is unfortunately not very good, as Nuno already noticed. For one, the "Select an Animal" text should not be part of the Static Entity, but a value in the Special List. Secondly, you would not have three ifs each with a description, but instead you'd have a single expression that's the result of a query returning the description.

I have attached a slightly better example that doesn't use a Static Entity.

Solution

Kilian Hekhuis wrote:

Hi Siseko,

The code that Nicholas offered is unfortunately not very good, as Nuno already noticed. For one, the "Select an Animal" text should not be part of the Static Entity, but a value in the Special List. Secondly, you would not have three ifs each with a description, but instead you'd have a single expression that's the result of a query returning the description.

I have attached a slightly better example that doesn't use a Static Entity.

Hello Kilian,

Thank you,it worked out.

Regards 

Siseko


Good to hear it worked (although of course I knew that ;)). As long as you understand how it works, I'm satisfied :) Happy coding!