Information générale
Catégorie:
Codage, syntaxe et commandes
Sometimes too many choices in fact :-).
BTW I often use the fact that cSomeField = '' is always true - eg a parameterised view can be set to all records that way.
>In addition, you actually have choices in VFP - using SET ANSI and SET EXACT. I find this to be a plus since sometimes I want == but sometimes I just want =.
>
>>>This is an example of FoxPro's somewhat 'faulty' logic of comparing strings. FoxPro checks each character on the right side of the expression to each character of the left until it reaches the end of the string expression on the right. (eg if 'ABCDEF'='ABC' it compares the 'A','B','C' and then hits the end of the string) Fox then asks itself if it found any that didn't match. Since it didn't, Fox says that the strings must be equivillant. That's why you NEVER use an expression using '' (eg if 'ABCD'='') This will ALWAYS be true no matter what variable you use.
>>>
>>>If you're looking for a quick fix, simply use the double equals (==). This forces Fox to check not only for content, but for length of the string as well.
>>>
>>>P.S. make sure you are indexed on alltrim(ID) or Rushmore isn't used.
>>>
>>>Good luck.
>>>
>>>Tom
>>
>>PMJI Tom,
>>What's jelly to some is jam to others:-). I use the "=" extensively knowing that it means "begins with". It's an extremely useful construct that I use over and over. Other languages are lacking in this regard, IMHO
>>Cheers
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement