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

163 Views Asked by At

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?

1

There are 1 best solutions below

2
On BEST ANSWER

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.

variable setup for updating filter

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.

example of the selected item updating