Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set Exact On or Off
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01517890
Message ID:
01517916
Vues:
47
>>>>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) 
>
>
>
Thank you for confirming that SEEK does take into account the SET EXACT setting.
"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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform