Unique value (not key) with security filter

Hello,
I am building an app that tracks the shipping status of packages via Rest API and webhooks. Over time, there will be thousands of tracking numbers, and I will need to use security filters to retrieve only:

  • Packages that have not been delivered yet
  • Delivered packages from the last 28 days

In my table, the tracking number is not the primary key. The chances of someone adding the same tracking number twice are very low (probably close to 0%), but I would still like to implement some kind of verification for peace of mind.

How do security filters work in this case? How can I ensure the same tracking number is not added twice? Or do security filters have nothing to do with this?

Thank you.

0 2 58
2 REPLIES 2


@pro100bear wrote:

How do security filters work in this case? How can I ensure the same tracking number is not added twice? Or do security filters have nothing to do with this?


I believe security filters simply filter out the records that do not meet the filter expression. The such records that are filtered out do not reach a user's device.

You could use suitable valid_if expression to detect duplicates. Please take a look at the following help article and the last section therein to know the expression to avoid duplicates.

Suvrutt_Gurjar_0-1737683726034.png

List expressions - AppSheet Help

However please be aware that such a duplicate prevention expression can still fail if more than one user is trying to enter the same value simultaneously.

Concurrent usage with multiple users - AppSheet Help

 

 

 

Steve
Platinum 5
Platinum 5

@Suvrutt_Gurjar wrote:

I believe security filters simply filter out the records that do not meet the filter expression. The such records that are filtered out do not reach a user's device.


Correct, which means that if a new tracking number is generated that duplicates one that has been filtered out, the duplication will not be detected.

If you generate the tracking numbers on the server rather than on the user's device, you can catch duplicates, but doing so would mean you can't use the tracking number as a the key column and a sync would be required  before the user could see the tracking number.