Paradox Community

Items in pnews.paradox-programming

Subject:Re: Array Search
Date:8 May 2019 16:53:48 -0400
From:"Steve L" <stevel@atlanticelec.net>
Newsgroups:pnews.paradox-programming

Peter, Thanks for your help. It would seem that this too only works if the
str is an exact match of the element. "ABC123 3/4 Widget" is found but "3/4
Widget" and ABC123 are not. I'm not sure where to go with this.

Steve


Peter <peter@removespamwhiteknight.email> wrote:
>oops, should be
>var
>    str          string
>    smicnt,
>    smipattern   smallint
>endVar
>
>str = "3/4 Widget"
>
>for smiCnt from 1 to ary.size()
>     smiPattern = str.search(ary[smiCnt])
>     if smiPattern > 0 then
>        do something here
>     endIf
>endFor
>
>
>Peter
>
>On 05/08/2019 06:24 AM, Steve L wrote:
>> The array search logic basically looks good. One question: what is [smiCnt]in
>> this line?
>> 
>> smiPattern = str.search(ary[smiCnt])
>> 
>> It seems to be undefined and I'm not exactly sure what this is?
>> 
>> Thanks.
>> 
>> Steve
>> 
>> "Steven Green" <greens@diamondsg.com> wrote:
>>> a query on a string in the middle of a field is the same slow pattern
match
>> 
>>> logic.. the advantage comes if you're going to have multiple results,
that
>> 
>>> you can throw into a temp table
>>>
>>> "this.." uses the index
>>> "..this" does not use the index
>>>
>>> the "search(this) > 0" logic has strong potential, it might be more
>>> functional, if you want locate / locate next.. but bottom line, a search
>> for
>>> a pattern in the middle of the field is slower cuz it can't use the index..
>> 
>>> been there, done that, many times
>>>
>>>
>>> --
>>>
>>> Steven Green
>>> Myrtle Beach, South Carolina, USA
>>>
>>> http://www.OasisTradingPost.com
>>>
>>> Collectibles and Memorabilia
>>> Vintage Lego Sets and Parts
>>> - and Paradox support, too
>>> "Thies Grimm"  wrote in message news:5cd2659f$1@pnews.thedbcommunity.com...
>>>
>>> a query shoulb be very fast
>>> something like
>>>
>>> db.open(myDataBase)
>>> itemSQL =
>>>    SQL
>>>      SELECT myField
>>>      FROM 'myTable'
>>>      WHERE myField like '%krit%'
>>>    endSQL
>>> itemSQL.executeSQL(db, tc)
>>>
>>> Should be very fast
>>>
>>> Thies
>>>
>>> Am 08.05.2019 um 03:03 schrieb Peter:
>>>> Maybe this?
>>>> search()smallint
>>>> searchEx()longint
>>>>
>>>> These return an integer of the first position of a string found.
>>>>
>>>> var
>>>>      str          string
>>>>      smi,
>>>>      smipattern   smallint
>>>> endVar
>>>>
>>>> str = "3/4 Widget"
>>>>
>>>> for smi from 1 to ary.size()
>>>>       smiPattern = str.search(ary[smiCnt])
>>>>       if smiPattern > 0 then
>>>>          do something here
>>>>       endIf
>>>> endFor
>>>>
>>>> Peter
>>>>
>>>> On 05/07/2019 10:59 AM, Steve L wrote:
>>>>> Peter <peter@removespamwhiteknight.email> wrote:
>>>>>> Something like this?
>>>>>>
>>>>>> for smi from 1 to ary.size()
>>>>>>       if ary[smi] <> pattern then
>>>>>>          do something here
>>>>>>       endIf
>>>>>> endFor
>>>>>>
>>>>>> OTH
>>>>>> Searching the table with a tcursor was too slow?
>>>>>>
>>>>>> Peter
>>>>>>
>>>>>>
>>>>>> On 05/07/2019 07:09 AM, Steve L wrote:
>>>>>>> I have an array of roughly 19000 elements. Is there a way to search
>> the
>>>>> array
>>>>>>> for in-exact matches much like locatePattern(,)does. Using
>>>>>>> ar.contains(Element)
>>>>>>> = True doesn't help if you don't key exactly as the element is
entered.
>>>>> Searching
>>>>>>> the table is too slow with that many records.
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>> Steve
>>>>>>>
>>>>>>>
>>>>>
>>>>> Peter,
>>>>>
>>>>> Thanks. This logic seems to be the same as Contains which is an exact
>> 
>>>>> match.
>>>>> If I have an element, ABC123 3/4 Widget, and am not sure of the part
>> 
>>>>> number,
>>>>> ABC123, but want to search on 3/4 Widget using the <> the logic will
>> not
>>>>> find the element because it's not an exact match.
>>>>>
>>>>> Searching the key field of the table with a Tcursor and locatePattern,
>> 
>>>>> the
>>>>> entire string of each record is examined which, with 19,000 records,
>> is
>>>>> too
>>>>> slow for data entry.
>>>>>
>>>>> Perhaps there is another way to find records using a pattern match
which
>>>>> I am not considering?
>>>>>
>>>>> Thanks.
>>>>>
>>>
>> 


Copyright © 2004 thedbcommunity.com