Search code examples
palantir-foundry

Bulk upload via action in slate


Input boxes

I have created input boxes in slate to add data into foundry, and each box represents a new row. Currently, I am using table storage service to bulk upload data to phonograph. Can I use actions widget to bulk upload to ontology?

For instance, If I create an action and call it in slate using action widget, it would only allow me to add one object at a time. Can I do a bulk upload?


Solution

  • If your Foundry stack currently relies heavily on Phonograph, then maybe keep using that. Otherwise, as you're perhaps implying, writing to the Ontology would be better -- more idiomatic Foundry, if you will.

    You can create multiple objects by passing some data structure (let's say it's stringified JSON, though it could be a collection) to an Action that's powered by an Ontology Edit Function that creates multiple new object instances based on that data (e.g. maybe it parses the JSON string and processes that data, creating one new object per item in that JSON blob). You'll want to create a PK in the Edit Function for each new object.

    For a concrete example, let's say you've got an integer value (N) for each month representing the number of Inspections that should be done that month. You might then want to create N_Jan number of Inspection object instances with property Month=Jan and some random PK, plus N_Feb number of Inspection object instances with property Month=Feb, and so on...