Subject | Re: [IBO] Re: Query.Locate -with OrderingItems & OrderingLinks |
---|---|
Author | Paul Vinkenoog |
Post date | 2003-11-18T13:07:16Z |
Hello Michael, Jason,
will locate e.g. a 'GARZON' and still return true! (As a customer
of mine discovered when I introduced lopFindNearest in a Locate.
BTW: I did this because I had the same problem as you, see below.)
And lopPartialKey will return true if 'GARY' ain't there but 'GARYLLA'
is.
Locate, and landed on the third or fourth matching record instead of
the first one.
This hasn't always been the case: I originally built that app with
IBO 3.x and it worked fine. Somewhere after an IBO upgrade the
Locate behaviour seems to have changed.
Interesting thing: most Locates *did* take me to the first match. But
the ones that didn't always took me to the same record as long as the
underlying table hadn't changed. I.e. if a certain Locate took me to
the third matching record, it would *always* do that. Nothing random
about it.
My first (bad) idea was to use lopFindNearest, but that caused me the
problem I described above.
Later I spend some time in the IBO sources, but quite a number of
functions are involved. I didn't have time to fully analyze and test
all that, so I changed my app instead - kicked out the troublesome
Locates. (I *did* notice however that Locate sometimes takes big
steps when looking for matches. Maybe it has to do with that: taking
giant steps and not always backstepping when a match is found?)
sets and/or parameterized sets. WhereItems can also be used. So now I
work with sets that only contain the records I want to step through.
In my case this was a cleaner and safer approach anyway.
I now only use Locates:
a) if I know that the search value, if it is found, is unique; or
b) if I don't care about the record itself, but just want to know if
a certain value exists in the column.
Greetings,
Paul Vinkenoog
>> * I have a dataset with fields "Salesperson", "ID"Careful with lopFindNearest! If there is no 'GARY' in the set, it
>> * "Salesperson" has many repeats, "ID" is unique
>> * With OrderingItems of "salesperson, id; salesperson desc,
>> id desc"
>> * I want to issue some command that will take me to the
>> first occurrence of a "salesperson"
>> * I thought "query.locate(('salesperson', 'GARY', [lopPartialKey,
>> lopFindNearest]);
will locate e.g. a 'GARZON' and still return true! (As a customer
of mine discovered when I introduced lopFindNearest in a Locate.
BTW: I did this because I had the same problem as you, see below.)
And lopPartialKey will return true if 'GARY' ain't there but 'GARYLLA'
is.
>> * Would do so, but even though it takes me to a recordI can confirm this behaviour: set well ordered, called First, called
>> with "GARY", it is not the first.
Locate, and landed on the third or fourth matching record instead of
the first one.
This hasn't always been the case: I originally built that app with
IBO 3.x and it worked fine. Somewhere after an IBO upgrade the
Locate behaviour seems to have changed.
Interesting thing: most Locates *did* take me to the first match. But
the ones that didn't always took me to the same record as long as the
underlying table hadn't changed. I.e. if a certain Locate took me to
the third matching record, it would *always* do that. Nothing random
about it.
My first (bad) idea was to use lopFindNearest, but that caused me the
problem I described above.
Later I spend some time in the IBO sources, but quite a number of
functions are involved. I didn't have time to fully analyze and test
all that, so I changed my app instead - kicked out the troublesome
Locates. (I *did* notice however that Locate sometimes takes big
steps when looking for matches. Maybe it has to do with that: taking
giant steps and not always backstepping when a match is found?)
>> * I only want to position to the first record with "GARY"My solution/workaround was to replace the Locates with Master-Detail
>> not step to the next from where I am.
>> Is there some other command I should be using? Do
>> I need to write some code that will cycle through the
>> records until it finds the right one (I can, I just
>> thought Locate was suppose to do that)?
sets and/or parameterized sets. WhereItems can also be used. So now I
work with sets that only contain the records I want to step through.
In my case this was a cleaner and safer approach anyway.
I now only use Locates:
a) if I know that the search value, if it is found, is unique; or
b) if I don't care about the record itself, but just want to know if
a certain value exists in the column.
Greetings,
Paul Vinkenoog