How can we pass the output of the filterList as an parameter to the typescript function in palantir-foundry-workshop?

126 Views Asked by At

I have created an filterList in the Workshop module, I want to pass the JSON output of this filter to other TypeScript function which I am calling while creating an other variable. How can I do that in workshop using the typescript functions?

I tried using the parameter as string type on the functions, it was working on the functions but on the Workshop I cant see the filter list output on the dropdown.

I need to create a variable which will call a TypeScript function, and I need to pass the filter list output as a parameter and the function will give me a string output which will be stored in the variable.

1

There are 1 best solutions below

0
On

I don't believe there is a way to provide the filters from Workshop to a Foundry Function, but you shouldn't need to. On principle, as long as the filters can be converted to a string type (e.g. just casted like a json-serialize, compressed, ...) this could be passed to the Foundry Function. Problem: I don't think there is a way to convert a Filter to a String.

Base case: If the goal is to filter an Object Set (so, to apply the filters to an Object Type of pre-existing Object Set), you can do it directly in Workshop. You can then pass this Object Set to your FoO for further processing.

If that's a matter of typing, you can use a "string selector" widget which you populate with an array populated by an Object Aggregation.
Note: I believe it would be more maintainable to migrate to the types used in your Object Types if those strings are used to filter an Object Set

Depending on how you want to consume those filters/select value downstream there might be other solutions (are you using those selected strings to process in a Foundry Function ? To populate a widget ? ...)