Expression to avoid repeating/replication of data

Hi

I am. Relating an app for a company. The app can capture up to 8 devices per user. In each device, I have a column called "Serial number/Barcode ", this is the column used to identify that device, and only that device because serial number /Barcode are specific to one device.

when I enter a serial number /Barcode that has already been entered I want the app to reject it, and shows an error message, to try to achieve this, I used the Valid_if, with the expression [_THIS] <>[Serial Number /Barcode device 2], and I repeated this expression for 6 other devices, I added all these expressions in the serial number /Barcode of the first device in the Valid_if,
. But the expre is not working

Solved Solved
0 16 692
1 ACCEPTED SOLUTION

Try something likeโ€ฆ
NOT(IN([_THIS],
TableName[Serial number/Barcode device 1]+
TableName[Serial number/Barcode device 2]+
โ€ฆ
TableName[Serial number/Barcode device 8]))

View solution in original post

16 REPLIES 16

Try something like as your Valid_IF:

ISBLANK(ANY(Select(YourTable[Barcdode],[Barcode]=[_ThisRow].[Barcode])))

Simon@1minManager.com

it does not work as expected, when i enter a repeat serial barcode / barcode it does not search if the serial number/barcode has already been entered in the system before, it only works if i repeat the serial number /barcode on the same form of the same device.

Steve
Platinum 4
Platinum 4

Try this as the Valid If for the first device:

NOT(
  IN(
    [_THIS],
    LIST(
      [Serial number/Barcode device 2],
      [Serial number/Barcode device 3],
      [Serial number/Barcode device 4],
      [Serial number/Barcode device 5],
      [Serial number/Barcode device 6],
      [Serial number/Barcode device 7],
      [Serial number/Barcode device 8],
    )
  )
)

Repeat for each deviceโ€™s column with corresponding device number adjustments.

Hi, I tried this one โ€œNOT(
IN(
[_THIS],
LIST(
[Serial number/Barcode device 2],
[Serial number/Barcode device 3],
โ€ฆ
)โ€

as instructed but it does not work as expected, it does not search if the serial number/barcode has already been entered in the system before, it only works if i repeat the serial number /barcode on the same form.

I am using the scan function to enter Serial numbers/ Barcodes ,is this maybe contributing to the failure?

Try something likeโ€ฆ
NOT(IN([_THIS],
TableName[Serial number/Barcode device 1]+
TableName[Serial number/Barcode device 2]+
โ€ฆ
TableName[Serial number/Barcode device 8]))

It worked!! Thank you.

Youโ€™re welcome

I have a Stock Item Table where I enter Product Barcode (Bc) and Product Name. Once I enter a Barcode and Save it then the next time if by mistake I am entering the Same Barcode it should show error โ€œYou are making a duplicate entry. This Barcode already exists in the Stock Item Tableโ€.

I tried with this formula in the Valid If of the Barcode (Bc) Column : NOT ( IN ( [_THIS], StockItem [Bc] ) )

It detects the duplicate Barcode and does not let me add a new entry but if I want to edit an existing entry also it does not let me edit saying that โ€œYou are making a duplicate entry. This Barcode already exists in the Stock Item Tableโ€.

Please let me know how to do this.

Thank you!! God Bless!!

Thanks for the reply!

This seems pretty difficult in my case as I have other Columns also that I want to check for duplicae entry in the same form, is there a simpler way to do this?

May be can you give me the expression that will work in my scenario?

Appreciate your help!

Thanx

You need to check against all of the records in the Table except the current record. Instead of StockItem[Bc], try using SELECT( StockItem[Bc] , ...) with a condition that will exclude the current record.

Idea Sounds Good!! Logically it makes perfect sense!!

Can you please gudie me what the expression should be and how to exclude the current record in that.

NOT ( IN ( [_THIS], SELECT(StockItem [Bc], ( [Bc] = [_THISROW].[Bc] ) ) ) )

I tried the above but gives error. I canโ€™t figure out how to exclude the current record that we are editing.

Thank You!!

I put the formula in Valid If, it allows edit but it also allows duplicate barcodes:
NOT ( IN ( [_THIS], SELECT(StockItem [Bc], ( [Bc] <> [_THISROW].[Bc] ) ) ) )

May be I am not putting the formula in the correct place. Please let me know.

Thanx

Try this instead:

NOT ( IN ( [_THIS], SELECT(StockItem [Bc], ( [_ROWNUMBER] <> [_THISROW].[_ROWNUMBER] ) ) ) )

This is an absolute Genius!! God Bless You!!

Thanks to everyone for your important inputs!!

Top Labels in this Space