'Palantir Workshop - Filter settings [closed]

I'm trying to implement a new feature in my workshop application and I get trouble with filters. I would like to have either a default value coming from another object (multiple select table) or event a map widget, but I did not manage to implement it.
The objective is to display a chart related to a selected object,n then allow the user to select other objects to add their details to the first one to be able to compare.

What I tried so far is to define 2 filters :

  • a first one initiated with a variable I catched once the user made a selection (currently a single value yet). My problem is that the filter is not selected by default, so nothing is displayed.
  • a second widget, more common, with all available values. But I would like to have nothing displayed if no values are selected (I have more than 2 thousand values, so the chart is not readable).

On top of that, If I manually select my default value, then add values to the second filter, nothing is displayed because the default behavior seems to be a king of AND rather than an expected OR.

What would you propose to manage this ?
Is there a way to pass a default value to a common filter (and how)? Or is there a possibility to implement a OR between filters, rather than AND, and make the second filter returning nothing if no values are selected?



Solution 1:[1]

  • Is it possible to define a default value that is selected when the page is loaded?. Yes! In short, setting a default value for the Object Set Filter variable that is output by the Filter List widget will result in those default property filters being applied within the Filter list when this module is initially loaded. This is described in more detail in the documentation for Workshop's Filter List widget that should be accessible at https://www.palantir.com/docs/foundry/workshop/widgets-filter-list/ .

  • Is it possible to define precisely AND/OR conditions between filters (and how)? Within a single Filter List widget, property filters within a single property type are applied as OR filters (e.g., filter when Alert Type == "Flight Delay" OR "Maintenance Issue") and filters between property types are applied as AND filters (e.g., filter when Alert Type == "Flight Delay" AND Alert Status == "Open"). For more complex behavior, two options are (1) using a Function-backed object set where you can define custom filtering logic in Typescript or (2) using multiple Filter List widgets and then building a new Object Set in the front-end that combines their output as desired. For example of (2), please see the screenshot below where Object Set C == (Object Set A + Object Set Filter A) OR (Object Set B + Object Set Filter B).

Object Set definition panel combination options

  • Is it possible to display nothing in a widget that input depends on filter values, if no values are selected (rather than displaying all rows) and to limit the number of selected objects? A Filter List widget without any filtering criteria applied produces an empty Object Set Filter variable, and it is not currently option to use that empty Object Set Filter variable act as a means of filtering out all objects in an downstream Object Set. (You could achieve this logic with the use of a function-backed object set that takes as its input the unfiltered object set and the potentially filtered object set. If the two object sets are the same, this means no filters have been applied and the function would return an empty object set. If the two object sets are different, the function would return the filtered object set.) As another option for this workflow, it's worth considering using the Object Selector widget instead of the Filter. The Object Selector widget can start with an empty selected object set and then allow users to search by title and select one or more objects, which can then be used as input for the Chart: XY widget for comparison.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 fmsf