Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set Exact On or Off
Message
 
 
À
11/07/2011 17:11:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01517890
Message ID:
01517909
Vues:
48
>>>Thank you. But what do you do when you need to SEEK() on exact value?
>>>
>>
>>SEEK already always work on the exact search pattern although you can control it with SET NEAR ON.
>>
>>
>>>>I generally set it off, then use == where I want an exact match
>>>>
>>>>
>>>>>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?
>>>>>
>>>>>TIA.
>
>SET EXACT does have an effect, as shown below:
>
>CREATE CURSOR Test ;
>	( cStr C( 4 ) )
>
>INSERT INTO Test ;
>	( cStr ) ;
>	VALUES ;
>		( "1234" )
>
>SELECT Test
>INDEX ON cStr TAG cStr
>
>SET EXACT OFF
>SEEK "123"
>? FOUND()  && returns .T.
>
>SET EXACT ON
>SEEK "123"
>? FOUND()  && returns .F.
>
>USE IN Test
>
I've tried this test in the meantime which confirmed that it will be a partial search:
CREATE CURSOR csrTest (ID I AutoINC, LastName C(10))
INSERT INTO csrTest (LastName) VALUES ('Litvak')
INSERT INTO csrTest (LastName) VALUES ('Boris')



INDEX on UPPER(lastName) TAG LN

SET EXACT OFF
SET NEAR OFF

SEEK UPPER('Lit')

=MESSAGEBOX(CAST(csrTest.ID as C(2)) + csrTest.LastName) 
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform