Discussion:
rowset.exactmatch
(too old to reply)
Frank J. Polan
2004-02-18 22:29:04 UTC
Permalink
Ken,

from the OLH
.........
ExactMatch
Determines whether rowset searches are conducted using a partial
string or an exact string match.
Property of Rowset
......................................
dBASE PLUS b1703 Win2000
Save the following form and run from Navigator
In the Entryfield enter the first letter of any of the 3 fields
Click the findkey button.
The findkey() returns true
Accorinding to the OLH it should return false when setexact is true

Frank Polan
............................... exactmatch.wfm ...............
close databases
close all
clear all
release all
clear memory
clear program
set proc to
//

if file('test.dbf')
drop table 'test.dbf'
endif
create table 'test.dbf' ( ;
field1 char (10), ;
field2 char (10) ;
)

insert into test (field1, field2) values ('abc', 'def')
insert into test (field1, field2) values ('ghi', 'jkl')
insert into test (field1, field2) values ('mno', 'pqr')

create index field1 on 'test.dbf' (field1)

** END HEADER -- do not remove this line
//
// Generated on 02/18/2004
//
parameter bModal
local f
f = new ExactmatchForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif

class ExactmatchForm of FORM
with (this)
onOpen = {;this.entryfield2.value := form.rowset.exactmatch}
height = 16
left = 53
top = 0
width = 40
text = ""
endwith

this.TEST1 = new QUERY()
this.TEST1.parent = this
with (this.TEST1)
left = 25
top = 4
sql = 'select * from "test.dbf"'
active = true
endwith

with (this.TEST1.rowset)
indexName = "FIELD1"
endwith

this.GRID1 = new GRID(this)
with (this.GRID1)
dataLink = form.test1.rowset
height = 5.5
left = 4
top = 1
width = 26
endwith

this.CHECKBOX1 = new CHECKBOX(this)
with (this.CHECKBOX1)
height = 1.0909
left = 5
top = 8
width = 14.1429
text = "Record Found"
endwith

this.ENTRYFIELD1 = new ENTRYFIELD(this)
with (this.ENTRYFIELD1)
height = 1
left = 6
top = 9.5
width = 8
value = ""
endwith

this.PUSHBUTTON1 = new PUSHBUTTON(this)
with (this.PUSHBUTTON1)
onClick = class::PUSHBUTTON1_ONCLICK
height = 1.0909
left = 6
top = 11.5
width = 15.2857
text = "Findkey"
endwith

this.TEXT1 = new TEXT(this)
with (this.TEXT1)
height = 1
left = 3
top = 13.5
width = 12
text = "Exactmatch"
endwith

this.ENTRYFIELD2 = new ENTRYFIELD(this)
with (this.ENTRYFIELD2)
height = 1
left = 18
top = 13.5
width = 8
value = ""
endwith

this.rowset = this.test1.rowset

function PUSHBUTTON1_onClick
x = form.rowset.findkey(form.entryfield1.value)
form.checkbox1.value := x
return
endclass
.
...............................

On Tue, 17 Feb 2004 23:13:31 +0100, Romain Strieff [dBVIPS]
paraphrased...
I have a table that the content of one record in the field "service" is
"Bloc operatoire".
----------------------------
var = "Bloc ope"
result = form.query1.rowset.findkey(var)
----------------------------
the result is TRUE. Normal or not ? Thanks for help.
HELP exactmatch
mark.i
2004-02-19 09:10:54 UTC
Permalink
Hi Frank,

The OLH for findkey clearly states that you should pad the
field with enough spaces to match the length of the fields.

"searches will be evaluated as a "match" only when they are
identical to your search string.", in this case and in
conjuction with the findkey rule, when you search for "a",
"ab"or "abc", findkey will always retrun true.

However, a + two spaces "a " will return flase.

Wth exactmatch set to true, "A" will return false, whereas
"a" will return true.

when searching, findkey evaluates the search according to
the input and the length of the string, but exactMatch,
depending on its value, determines whether the search is
case sensitive or not.

All you have to do in your example is to type "A" then click
on the findkey button, "record found" will remain false.

Therefore, the OLH for exactMatch is incorrect:

"Determines whether rowset searches are conducted using a
partial string or an exact string match."

The test, for exactMatch, show rowset searches are case
sensitive only, it has nothing to do with the length.

It'll be good to know if it is a WAD rather than a bug, or
just a misinterpretation in the olh, in which case it should
be corrected.

Mark.i
Frank J. Polan
2004-02-19 14:49:45 UTC
Permalink
Mark

See comments below

On Thu, 19 Feb 2004 09:10:54 -0000, "mark.i"
Post by mark.i
Hi Frank,
The OLH for findkey clearly states that you should pad the
field with enough spaces to match the length of the fields.
The above is the OLH for findkey() and I don't have any problem with
that
Post by mark.i
"searches will be evaluated as a "match" only when they are
identical to your search string.", in this case and in
conjuction with the findkey rule, when you search for "a",
"ab"or "abc", findkey will always retrun true.
However, a + two spaces "a " will return flase.
ditto above
Post by mark.i
Wth exactmatch set to true, "A" will return false, whereas
"a" will return true.
I don't see this behaviour. "A" allways returns false, which I would
expectt
Post by mark.i
when searching, findkey evaluates the search according to
the input and the length of the string, but exactMatch,
depending on its value, determines whether the search is
case sensitive or not.
ditto above
Post by mark.i
All you have to do in your example is to type "A" then click
on the findkey button, "record found" will remain false.
I don't see this
Post by mark.i
"Determines whether rowset searches are conducted using a
partial string or an exact string match."
The test, for exactMatch, show rowset searches are case
sensitive only, it has nothing to do with the length.
It'll be good to know if it is a WAD rather than a bug, or
just a misinterpretation in the olh, in which case it should
be corrected.
Yes
Post by mark.i
Mark.i
Thanks

Frank Polan
Romain Strieff [dBVIPS]
2004-02-19 16:31:19 UTC
Permalink
Post by mark.i
The OLH for findkey clearly states that you should pad the
field with enough spaces to match the length of the fields.
The item was written years before .exactmatch was added to the rowset.
--
Romain Strieff [dBVIPS]
http://www.dbase.com/Docs/newsguid.htm
mark.i
2004-02-19 19:13:17 UTC
Permalink
Post by Romain Strieff [dBVIPS]
Post by mark.i
The OLH for findkey clearly states that you should pad
the
Post by Romain Strieff [dBVIPS]
Post by mark.i
field with enough spaces to match the length of the
fields.
Post by Romain Strieff [dBVIPS]
The item was written years before .exactmatch was added to
the rowset.

Doesn't matter when it was written, the findkey's behaviour
is still the same, nothing has change. However, there is a
conflit of statements between findkey-olh and
exactmatch-olh.

The exactMatch-olh says:

"Determines whether rowset searches are conducted using a
partial string or an exact string match."

This is incorrect.

OLH Description

exactMatch allows you to determine what constitutes "equal
to" when performing rowset searches. When exactMatch is set
to "true", the default setting, field values in subsequent
searches will be evaluated as a "match" only when they are
identical to your search string.


** identical in this case should mean -the same- in both
length and case**

When you set exactMatch to "false", a partial string, or
"begins with" search is performed. Searching for the string
"S", for example, will find "Smith" and evaluate it as a
match.


** when exactmatch is set to true, the search is case
sensitive only. Partial searches are allowed regardless of
the peroperty's value **

Therefore, the statements above are incorrect.

findkey is used to search for a value by observing the
finkey rule.Exactmatch determines how to match an input
against the data stored in a rowset. My understanding of the
difference between the property "exactmatch" and the method
"findkey", after testing, might be completely wrong, but
the confusion is caused by the conflict of statements.

All the best
Mark.i
Ken Mayer [dBASE, Inc.]
2004-02-19 21:14:26 UTC
Permalink
Post by Frank J. Polan
.........
ExactMatch
Determines whether rowset searches are conducted using a partial
string or an exact string match.
Property of Rowset
......................................
dBASE PLUS b1703 Win2000
Save the following form and run from Navigator
In the Entryfield enter the first letter of any of the 3 fields
Click the findkey button.
The findkey() returns true
Accorinding to the OLH it should return false when setexact is true
I've asked R&D to look at this message thread.

Ken
---
Ken Mayer [dBASE, Inc.]
** Please respond ONLY in the newsgroups **

"Think OOP"

dBASE, Inc. website: http://www.dbase.com
Frank J. Polan
2004-02-19 21:52:20 UTC
Permalink
Ken,

Thanks

Frank polan
On Thu, 19 Feb 2004 13:14:26 -0800, "Ken Mayer [dBASE, Inc.]"
Post by Ken Mayer [dBASE, Inc.]
I've asked R&D to look at this message thread.
Ken
---
Ken Mayer [dBASE, Inc.]
** Please respond ONLY in the newsgroups **
"Think OOP"
dBASE, Inc. website: http://www.dbase.com
Loading...