Hi, is there any slick way to run a script that removes/appends duplicates in a big table, given that big tables aren’t allowed to relate or lookup to themselves?
Hello @Airbid.
There are two ways you could go about this process.
- Deleting duplicates natively in Glide
For this method, you must create relations in the big table, to itself. This can only work if you are using non computed columns as the relation source and the related source.
Once this is done, you can create a collection of the big table. In this collection, once you enter the item, you should create another collection (within the item’s detailed page). The collection within the item will be sourced from the “self relation” column. Here, you can just add a delete row button to each item. Then, you will have to manually delete each duplicate item within the main item’s relation.
Just as a safe practice, make sure that you filter your self relation collection (inside the item’s detailed screen) such that “row ID is not the main item’s row ID”. This is important because of this is not done, the item may show you a row that is itself. And you may end up deleting the main item.
- Deleting Duplicates using Glide’s API
this is a faster yet more complex process.
For this, you will have to query you big table and the columns you need to identify duplicates Using the Glide big tables API. Once you have queried the data, you can use basic matching of the rows by mapping then to themselves. Once you do this, you must use those duplicate row IDs in a Glide apps mutation API call to delete the duplicate rows.
If you want a script, I can share it with you.
I think you would still be able to relate to itself as long as the target column you’re using is not a computed column?