 |
Search
IT Courses |
|
|
|
|
|
|
|
|
|
|
|
IT
dart News Letter
|
Get
ITdart.com weekly headlines before it's published on our site! Subscribe
and receive the articles delivered to your inbox!
|
|
|
Enforcing uniqueness in memo fields
A common problem is that the INDEX ON command of FoxPro does not accept 'memo' fields. If you want memo fields to be indexed just for ensuring uniqueness, it is possible to manage this using some innovative code. The assumption here is that if two memos are not unique, their dissimilarity will be evident in the first 240 characters.
Here are the steps to implement unique memo fields in VFP.
1. Create a new database (.DBC file):
On the File menu, click New. Select Database, and then click the New File button. Place the new database (.DBC file) in the directory of your choice. 2. Add a table to the database:
Right-click the Database Designer, and select New Table. Click the New Table button. Create the table in the directory of your choice. In the Table Designer, add a memo field. 3. Add a unique index tag to the table:
Click the Index tab. Under Name, type the name of your memo field. Under Type, select Primary or Candidate (Unique won't work). For the expression, enter the following where MaxLen is any value up to the maximum of 240: PADR(MemoField, MaxLen) 4. Now try to add several records to the table with exactly the same content in the memo field to verify that the procedure is set up properly.
|
|
|