Search code examples
palantir-foundryfoundry-workshop

How can I create unique property apart from primary key in ontology


Is there any way to create a unique property apart from the primary key in ontology object or Is there any way to check for duplication of data in particular field throught workshop?


Solution

  • You can set a property to any value when you're creating an object. Property values come from two places:

    1. Backing dataset pipeline - You can change the logic creating the backing dataset to create values that would be unique. Easiest way is to use a window and apply the row_number function. You can find an example here
    2. Object creation action -
    • (1) You can have your object creation action to be function backed. Then inside the function you can create any sort of unique values you want. There is even an example in the documentation on how to set up rids.
    • (2) Alternatively you can have a function in your workshop module that creates a new unique value and sends it through to the creation action as a parameter. This way you can show it to the user, allow them to modify it and disable the action if the value is not unique.