Workshop question

Hi,

In my workshop module, I need to display rows only if column A > column B. How to implement this? Thank you!

Hi @Alearner,

You can create a small TypeScript function that takes in your object set, does this filtering, and then outputs a subset of your object set where the condition A > B matches.

Let me know if you need help building that.

1 Like

@Alearner Try Using Pivot table Widget

I am with @jakehop . A simple ts function to output the filtered object set will be straight forward.

if ts functions are not your thing you can alternatively create a derived property. I believe so far you can’t do case statements. But you could do create a new derived property diff=a-b and then create a new object set variable that filters for diff > 0

https://www.palantir.com/docs/foundry/workshop/derived-properties/

1 Like

Yes, would like to see sample code. Thank you

https://www.palantir.com/docs/foundry/workshop/widgets-object-table/#configure-a-single-function-backed-property

This is TSv1:

@Function()
public flightAlertCalculateUrgency(flightAlerts: ObjectSet<FlightAlertWorkshopTutorial>):
FunctionsMap<FlightAlertWorkshopTutorial, string>{
    const map = new FunctionsMap<FlightAlertWorkshopTutorial, boolean>();
    flightAlerts.all().forEach(flightAlert => {
        var hoursDelayed = flightAlert.timeOfDelayHours
        if (flightAlert.prop1 > flightAlert.prop2) {
            map.set(flightAlert, True)
        }
        else {
            map.set(flightAlert, False)
        }
    });
    return map;
}
1 Like