I have a table with 3 fields: firstname c (50), lastname c (50) and birthdate d(8)
I want to order the table first on birthdate, then on lastname and then on firstname.
How to manage it correctly?
It's not a good idea to build an index based on ALLTRIM(), or on any variable length expression.
From VFP Help:
Code:
If you attempt to build an index with a key that varies in length, the key will be padded with spaces. Variable-length index keys aren't supported in Visual FoxPro.
In some cases it could potentially create problems.
If you are worried that Lastname or Firstname field can start with a space, you should LTRIM() the space and then PADR() the value again to some fixed length.
But the best thing is to maintain the table without the leading spaces and to use the whole Lastname and Firstname in the index key.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.