Check for Duplicates - Syntax Assistance Needed

Good morning, all. I have my first app almost working pretty well, its been a fun learning experience with plenty more to go. This morning, I am hoping to build in some sort of duplicate testing to make sure that things don't get entered twice. I looked at this article:

https://www.googlecloudcommunity.com/gc/Tips-Tricks/How-to-Prevent-Duplicate-Records/m-p/322114

In that article, they give this an as example:

 

Not(In([_THIS], SELECT(Table[Column_Name_for_THIS_Column], [TableID] <> [_ThisRow].[TableID])))

 

 

I am trying to understand this expression and adapt it for my uses but am having some trouble with syntax.

My data has a dynamically generated UNIQUEID() for the key on each record created. Each record also has a First Name, Middle Name, and Last Name field, as well as date of both.

I have a virtual column in AppSheet called Full Name that concatenates the three name fields.

I am hoping to adapt this script to check the virtual column Full Name as the user is typing, so that if the first,middle, and last name comes up as a match, a message is displayed onscreen that the name already exists in the data.

So, breaking down the example above, we have the entry is valid if
The value is NOT in the selected table and column. I Think that is the only part that is clicking. I'm not sure i understand what comes after the comma, [Table ID]<>[_ThisRow].[TableID]

Still looking at tutorials and reading the expression guide on some of these things, but if you have a better way of explaining the above sample expression, i'm all ears. 

Also, can a virtual table be used to hunt for duplicates? If not, i need to figure out some other way to make these comparisons.
Thanks

Solved Solved
0 3 260
1 ACCEPTED SOLUTION

I was able to get this figured out. I used this expression:

NOT(IN([_THIS], (SELECT(Patients[_duplication_test],true))))

To break this down in case future me comes back and reads this (or in case it helps someone else), this expression says:

This statement is false: ....(The value of column '_duplication_test') is one of the values in the list (The list of values of column '_duplication_test' ........from rows of table 'Patients' ........where this condition is true: ("true"))
or something to that effect. I'll need to re-read this a few times for it to click, but i am happy to have it working.

View solution in original post

3 REPLIES 3

I think i may have answered one of my questions, i don't think the virtual column will be usable for this. I may need to create a new field to collect the full name through concatenation. This may take some thought ๐Ÿค”

Just thinking out loud as i work through this. I added physical column to the dataset called _duplication_test and it has a formula in AppSheet to concatenate first name, middle name, last name, and date of birth.

Now I just need to get the comparison syntax down. I also need to edit the few records that are currently in the dataset so this new value gets written to each and there is actually something to compare.

I was able to get this figured out. I used this expression:

NOT(IN([_THIS], (SELECT(Patients[_duplication_test],true))))

To break this down in case future me comes back and reads this (or in case it helps someone else), this expression says:

This statement is false: ....(The value of column '_duplication_test') is one of the values in the list (The list of values of column '_duplication_test' ........from rows of table 'Patients' ........where this condition is true: ("true"))
or something to that effect. I'll need to re-read this a few times for it to click, but i am happy to have it working.

Top Labels in this Space