Hi, I have TableA and TableB, which have one-to-many relationship - TableA has column IdTableB which contains Id of TableB. I have created record of TableB and later used this record as a reference while creating a record in TableA. So now I have TableA record which has in column IdTableB an Id of recently created record TableB. Here is my question: How do I implement check, to not perform delete action of record of TableB, when the record is referenced (used) in another table? I am using auto-generated delete action for TableB, which doesn’t make any check and simply deletes the record and then in every table where this Id has been used, remains the IdTableB value untouched, but it points to non-existing record. I guess one way is to create code repository where you implement delete action and then write a custom method for checking whether the record has been used somewhere else or not. However, I haven’t find working solution so far. Also, I am wondering if there is a simpler way to do this, with some checkbox in settings of the table. The tables (datasets) have been created through Pipeline builder where I specify new “manually entered table” and then create new dataset from it.
Hi @MVP I would do what you mentioned above and create a typescript function that does a check before deleting the value. You can perform this check by doing a searcharound or just filtering object set A on the idTableB value. If the search around or filter doesn’t return anything, you can safely delete the record in question.
That is the thing I don’t know how to do. In my case TableA = Prejimka, TableB = Vendor, so Prejimka has field VendorId with reference to Vendor record. My issue is that I don’t know how to write query that will reach Prejimka data and do the check. I would do something like Prejimka.Where(p => p.VendorId == vendor.Id).Any(); or similar, however, the language/compiler doesn’t seem to know these methods. Another way I have in my mind is to go as on the image below, where you reach through property. But it looks like dead end as well. Is there a any library I can reference to enable querying (as I can do for example in C# with Linq)? I am also showing references used (Object Types - Prejimka, Vendor) in case I don’t have the right sources needed.
You would want to do an object search across all of Prejimka (documentation here: https://www.palantir.com/docs/foundry/functions/api-object-sets/)
So something like:
const vendors = Objects.search()
.prejimka()
.filter(x => x.vendorId.exactMatch(vendorid_from_vendor))
.all();
and then check if vendors is empty