Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Simple way to test that values in a table are unique?

Avatar

11-12-2008

Is there any property to force repeating fields to be unique? I have multiple rows in a table and I want each instance of the "Name" field (Name[*]) to be unique.



I'm hoping there's a property I can select, so I don't have to add a script to test every row in the table to see if the value already exists. There are a lot of scripts running on this table already, so I'm afraid that more looping and testing will impact the performance as more rows are added to the table.

Replies

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

11-12-2008

It is unique by default. The somExpression is what you want (not the name) and that is unique. There is an occurance number on the row (as that is the repeating subform) and thats what makes it unique. So to address the field it woudl be something like this:



form1.Page1.Table1.Row[occurance number].Name.rawValue

Avatar

11-12-2008

It's the value of the "Name" field that needs to be unique. I need to prevent the user from entering the same name more than once.



Say the table has five rows with fields called Name, Rank, SerialNumber. I'd like to prevent the following entries:



Thing1, private, 12345

Thing2, captain, 23455

Thing2, corporal, 66666

Thing2, lieutenant, 55555

Thing3, sgt., 99999



I was hoping I had missed a setting in the one of the properties for the field that would define it as unique. I know it's a long shot, but it would save a lot of time at runtime.

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

11-12-2008

No there is nothing like a check box that will only accept a unique input. You woudl have to get the value and test it against all other values in the table. You could do it on the exit event of the field and if you get a match then pop up a message box and return the cursor to that field.