How do I get the SelectedValue of a DropDown?

During Preparation I want to hide a table column based on the selectedValue of a DropDown.

Pseudo code:
if myDropDown.SelectedValue = 1 
then myCol.Visible = False

How can I accomplish this in Outsystems?

Hi Andre.

When you use a dropdown, you need to associate it a variable.
So, you should have a variable (Data Type "Integer", for example), and then you use that variable wherever you want.

In your case you should add to the table columns an extended property:
- Name: style
- Value: If(yourVariable = 1, "display:none;","display:true;").
(you can ignore "display: true;" on else clause, cause is the column default.

Continue the good job, learning Outsystems. The Community would help you whenever you need.

Luís Figueiredo
Thanks for your reply but this will still render all the data to the client and hide it via CSS. Is there no server-side option to exclude elements from being rendered?
Hello Andre,

I'm not sure if you have seen the videos in the Academy.
Check this video to be sure you fully understand how a Combo Box works.

In regards to your question about excluding elements from being rendered, in OutSystems you use an IF to do this. Check this video at 7:40, the instructor shows how you use the IF.

Now lets review what you want to achieve:
  1. The user changes the value selected in the combo box
  2. You execute some logic that will evaluate what was chosen
  3. You refresh your table to ensure that the table will only display the correct columns
Since the Preparation only runs on the first time the user requests the page, you cannot execute your logic in the preparation.

Check this video to understand how you can use Ajax to implement something similar: when the user clicks a button/link we show and hide some text.

After watching all these videos, you just need to know that the Combo Box has one property called OnChange.
Simply create a Screen Action and set the OnChange property to that action. The new action will be called everytime the user changes the value in the Combo Box.

Finally I just want you to give a little heads-up. Conditionally hidding columns in a list is not trivial: while it is easy to hide the content inside the column, there is no easy way to hide the column itself. 
Start by hidding the content of the column, and then try to fiddle around with the application to find a way to not show the empty column, when the content is hidden.

I hope to have guided you in the correct direction