Stop duplicates from being created in child record table

Well this is long winded because I still have so much to learn. I’ve spent a lot of time going through the documentation and this forum and trying different things but I can’t seem to figure this one out.

I am creating an inspections app. There are 7 categories, each with a set of items to be inspected. When a user creates a new inspection, they will choose which categories (enumlist) they will be inspecting because it changes depending on the equipment. I copied and slightly modified the idea of Fabian’s “Enum2Children” app, using the standard items method to make a grouped action that adds all of the the inspection items to a child table depending on what categories the user selected in the original form. That part works well, but the problem is each time the form is reopened and saved it causes the records to be duplicated. (Obviously if I just use an action button instead of form save it still duplicates if I click it again too.)

Parent Table (inspection report): KEY | REPORT | CATEGORY enumlist | other columns
Child Table (line items): KEY | REPORT ref ispartof parent table | CATEGORY | ITEM | other columns
Standard Items Table read only: KEY | ITEM | CATEGORY enumlist (many categories per item)

The add-new-row to another table action behavior I have for each item: AND(IN(“Category Name”, [Category]), ISNOTBLANK(INDEX(SELECT(Standard_Items[Name] , IN([_THISROW].“Category Name” , [Category])) , 1)))

The grouped action behavior: NOT(IN(INDEX(SELECT(Standard_Items[name] , IN([_THISROW].[report], [category])) , 1) , [Related Line Items][Item]))

So like I said, it adds all the correctly chosen items based on the category when the form saves. But if the user opens and saves the form again it will add all of the same items again with new key values. How do I stop this from happening?
I’m also wondering if there is a way to remove the child table items if the user goes back into the form and unselects the categories (rather than having to visit the table view and delete the items manually). Not a big issue if there isn’t, just a thought.

Thanks for all of your help!

0 2 314
2 REPLIES 2
Top Labels in this Space