Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Set Exact On or Off
Message
 
 
To
11/07/2011 17:02:03
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01517890
Message ID:
01517918
Views:
31
>>>>Hi,
>>>>
>>>>I ran into a problem today that was caused by the fact that in one of the form's LOAD method there was SET EXACT ON. So I started checking further and found that a few other forms have SET EXACT ON in the LOAD. I am not going to ask why I put this code there <g> (who knows). But in general do you recommend never to have SET EXACT ON as global setting (in LOAD) and only set it ON in places where it is necessary and then reset it back to OFF?
>>>
>>>It doesn't answer your question, but I can't recall ever using SET EXACT ON. I always use the == operator when I need an exact match.
>>>
>>>In general, if you're doing something "unusual" you want to minimize the amount of time it's in effect e.g.
>>>
>>>lcOldSetExact = SET( "EXACT " )
>>>SET EXACT ON
>>>
>>>* Stuff that requires SET EXACT ON goes here
>>>
>>>SET EXACT &lcOldSetExact
>>>
>>>That said, SET EXACT is scoped to a datasession. So, if your form uses its own datasession, when you close it the SET EXACT no longer has any effect. If it's OK for SET EXACT to be ON for the duration of the form, it might be OK to leave it in the .Load.
>>
>>Thank you. Everything you stated makes sense. The only place, I can think of, that I would need to SET EXACT ON is where I need to use SEEK() on exact value.
>
>I don't use SEEK much anymore, I've mainly converted to using SQL commands. When I do use SEEK I make sure I never SEEK on a string that is less than the length of the key (right-pad if necessary), and I also make sure my key expressions don't have trailing spaces (so I don't have to right-pad in the first place).

I agree with you for the most part. Although I do have one case (which prompted this thread) where the SEEK has to be done on a substring of the index key. But now with SET EXACT OFF it works.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform