Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Seek - not exact search? What does influence on it?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00312453
Message ID:
00312488
Views:
19
>Hi everyone,
>
>Today I found that function seek() does not exact search. Does it respect exact settings? I didn't notice this before...
>
>Test example: (haven't checked exact settings)
>
>create cursor hhh (code C(5))
>select hhh
>for i=10000 to 99999
>  insert into hhh value (alltrim(str(i)))
>endfor
>index on code tag code
>? seek('111','hhh','code') && return .t.
>
Nadya,

SEEK is affected by the SET EXACT setting as to whether partial mathces are considered hits or not.

The safest way to enforce exact matching is;

? SEEK(PADR("111",LEN(hhh),"0"), "hhh","code")

This pads your string search with 0's to match the length of your field. Since the == operator is not available in the SEEK command or function this is the way to get an exact match. SETting EXACT ON will not differentiate with two values that have trialing spaces as their difference.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform