How can I select first value of the dropdown by default in Palantir Foundry Workshop?

I have a string dropdown populated by a variable in Workshop. I would like the dropdown to select the first value by default when the underlying set recomputes. How could I do that?

Question originally asked by 3yakuya on Stack Overflow: How can I select first value of the dropdown by default in Palantir Foundry Workshop? - Stack Overflow

I think the output variable can be a variable transform or aggregate (i.e. min) by removing the variable from the string selector widget, configuring it, and then adding it back to the widget. Hope this helps, if not, can you please provide more context or example values?

In a case like this, you have 3 object sets (one of which is the currently-selected object), plus whatever changes the “input” object set. In my example below this is a filter, but it could be a function, the result of some user interaction, etc.

  • (BLUE) Object Set that is your starting object set. In the example below I’m using a Rides object type (e.g. in a theme park) and this object set is defined simply as all Rides. In my example this is the “OBJECT SET” to the filter widget config panel.
  • (GREEN) Object Set that is the input to the dropdown. This is the one that’s affected by filter I describe below. To create it, I started with all Rides (BLUE) and applied a filter variable (YELLOW). If, for example, you’re using a function instead of a filter to change the object set, then this object set would be the one returned from the function. This is the “INPUT OBJECT SET” for the Dropdown widget config panel.
  • (RED) The selected object in the dropdown. When you add the widget, this is created automatically for you. In my example, I renamed this variable. This is the “SELECTED OBJECT” in the filter widget config panel.
  • (YELLOW) Filter Output. Again, this is specific to my example. Maybe in your situation there’s a function that changes the object set that’s in the dropdown menu. This is the “FILTER OUTPUT” for the filter widget config panel.

Conceptually, what’s happening here is:

  1. The Filter widget takes (BLUE) Object Set as its input and returns a (YELLOW) Filter Output.
  2. (YELLOW) Filter Output is used to construct a new (GREEN) Object Set.
  3. (GREEN) Object Set is used as input to the dropdown.
  4. (RED) selected object in the dropdown will update whenever the (GREEN) object set updates.

ePexample of the selected item updatingVpg

Answer originally provided by Ontologize on Stack Overflow: How can I select first value of the dropdown by default in Palantir Foundry Workshop? - Stack Overflow