Help with preventing duplicates through actions

I have an app that uses a action button to route for approval (picture below), the button is using the "add a new row to another table using the values from this row" option. I am using the draftID (Unique id for this table) as a foreign key to the other table as a reference. 

Rhage_0-1709955298619.png

Whenever I try putting condition such as:
NOT(IN([_THISROW].[draftid], SELECT(tblrouting[draftid], [draftid] <> [_THISROW].[draftid])))
it still goes through and creates a new row even though there is already a draftid with a different routeid (primaryid for tblrouting) that exists.

Main goal is to just have one routing at a time per draft, I will also put in an additional condition here that checks the status.

I hope someone can help me on this as this is a bit crucial for the app that I am currently working on.

 

Solved Solved
0 3 94
1 ACCEPTED SOLUTION

if understanding of your requirement is correct, in the action  "add a new row to another table using the values from this row"  's  "Only if this condition is true" setting, please add an expression something like 

COUNT(SELECT([Related tblroutings][tblroutings table key], [Status]="Active"  ) )=0 

This will ensure that the action is available only to those parent table ( Draft table) records  if there are no related table routing rows in the Routings table where [Status]="Active"

You can of course change the [Status] related part as per the status values you have.

View solution in original post

3 REPLIES 3

if understanding of your requirement is correct, in the action  "add a new row to another table using the values from this row"  's  "Only if this condition is true" setting, please add an expression something like 

COUNT(SELECT([Related tblroutings][tblroutings table key], [Status]="Active"  ) )=0 

This will ensure that the action is available only to those parent table ( Draft table) records  if there are no related table routing rows in the Routings table where [Status]="Active"

You can of course change the [Status] related part as per the status values you have.

Thanks @Suvrutt_Gurjar, i did some little tweaks on what you suggested, now it works for me. Thank you so much ๐Ÿ™‚

You are welcome.  Thank you for the update.

Top Labels in this Space