Page 1 of 1

How to avoid duplicate data?

Posted: Mon 20 Sep 2010 22:17
by 99Percent
How can avoid duplicate fields in a virtual table? There is no keyfields property and lookup and locate don't work while editing a record.

Posted: Thu 23 Sep 2010 10:52
by AndreyZ
Hello,

I could not reproduce the problem.
Please send me a complete small sample to andreyz*devart*com to demonstrate the problem.

Posted: Fri 24 Sep 2010 19:12
by 99Percent
Let me explain a bit more.

Supose you want to add a row with a field that requires unique values. How do you check that the field does not contain data that is already in the dataset?

For example you have a table T with Field F, you want to be sure Field F does not have a value already present in the table T before adding the row to the table. How do you check? If you are editing the row and call Locate, a scroll event occurs that forces the record to be posted, and VirtualTable does not have a Keyfields property that will disallow the row to be inserted with the duplicate value.

Posted: Tue 28 Sep 2010 08:38
by AndreyZ
The TVirtualTable component doesn't support such functionality. But you can write the code that checks TVirtualTable for duplicate records using the AfterPost event and the Locate method.