Find a record starting with "XYZ" 
Author Message
 Find a record starting with "XYZ"

Hi all

I need to find the nearest matching record to some string key field -
but not in a browse. I just want to process records e.g. *starting* with
"XYZ" (or any other string :). Ok, my idea so far was as follows:

1) look for an exact match, if not found proceed with 3)
2) insert a record with exactly "XYZ" in the string field
3) locate that record and start processing with the next record
4) for each record check wether it starts with "XYZ" to find the end of
matching records
5) delete "XYZ"

Problems: in a multi-user environment two users could want to process
the same records at the same time, both want to access records starting
with "XYZ". User A is early and inserts "XYZ". User B is late and finds
"XYZ" inserted by User A only for locating the starting point. User B
will not be able to distinct between that "locating record" and a "real
record".

Anyway, there should be a more elegant way. Any ideas?
--
Regards
R. Gathmann



Sat, 05 Feb 2005 19:34:56 GMT  
 Find a record starting with "XYZ"
key:field = 'XYZ'
Set(key, key)
Loop
  Next(file)
  If errorcode();break.

--

Steve Parker

--------------------------------------------------
kb and download center at:
     www.par2.com
--------------------------------------------------


Quote:
> Hi all

> I need to find the nearest matching record to some string key field -
> but not in a browse. I just want to process records e.g. *starting* with
> "XYZ" (or any other string :). Ok, my idea so far was as follows:

> 1) look for an exact match, if not found proceed with 3)
> 2) insert a record with exactly "XYZ" in the string field
> 3) locate that record and start processing with the next record
> 4) for each record check wether it starts with "XYZ" to find the end of
> matching records
> 5) delete "XYZ"

> Problems: in a multi-user environment two users could want to process
> the same records at the same time, both want to access records starting
> with "XYZ". User A is early and inserts "XYZ". User B is late and finds
> "XYZ" inserted by User A only for locating the starting point. User B
> will not be able to distinct between that "locating record" and a "real
> record".

> Anyway, there should be a more elegant way. Any ideas?
> --
> Regards
> R. Gathmann



Sat, 05 Feb 2005 19:38:45 GMT  
 Find a record starting with "XYZ"
Steve Parker schrieb:

Quote:

> key:field = 'XYZ'
> Set(key, key)
> Loop
>   Next(file)
>   If errorcode();break.

this will locate a record of exactly "XYZ". Not a record like "XYZABC".
--
Regards
R. Gathmann


Sat, 05 Feb 2005 19:51:28 GMT  
 Find a record starting with "XYZ"
Ralph Gathmann schrieb:

Quote:

> Steve Parker schrieb:

> > key:field = 'XYZ'
> > Set(key, key)
> > Loop
> >   Next(file)
> >   If errorcode();break.

> this will locate a record of exactly "XYZ". Not a record like "XYZABC".

Ooooo.... disregard. Confused that with GET *g*
--
Regards
R. Gathmann


Sat, 05 Feb 2005 19:54:25 GMT  
 Find a record starting with "XYZ"
this works for me
        !------------------------------------------
        ! XYZKey KEY( fil:Fieldname ),DUP,NOCASE
        !
        Access:Filename.ClearKey(fil:XYZKey)
            fil:Fieldname = 'XYZ'
        SET(fil:XYZKey, fil:XYZKey) ! can be deleted ???
        !------------------------------------------
        LOOP WHILE Access:Filename.Next() = Level:Benign
            !-------------------------------------------------------------
            IF    LEFT(fil:Fieldname, 3) <> 'XYZ'
                BREAK
            END !IF
            !-------------------------------------------------------------
            DO StuffHere
            !-------------------------------------------------------------
        END !LOOP
        !------------------------------------------

Regards John


Quote:
> Ralph Gathmann schrieb:

> > Steve Parker schrieb:

> > > key:field = 'XYZ'
> > > Set(key, key)
> > > Loop
> > >   Next(file)
> > >   If errorcode();break.

> > this will locate a record of exactly "XYZ". Not a record like "XYZABC".

> Ooooo.... disregard. Confused that with GET *g*
> --
> Regards
> R. Gathmann



Sat, 05 Feb 2005 21:42:57 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. "Starting Forth" found in NJ

2. string.join(["Tk 4.2p2", "Python 1.4", "Win32", "free"], "for")

3. Typo in "Help/Gettting Started Workspace"

4. Delay to start a "while loop"

5. FS: "Starting/Thinking FORTH"

6. Concurrency (Connected to "Starting Again...")

7. Starting "daemon-like" processes with exec

8. BEGIN{want[]={"s1o", "s2o", "s2q", "s3q"}

9. File Loaded Drop Box "None" Record

10. Printing "DAS Tagged" Records problem

11. "Link Error: Unsupported record type21 0"

12. EIP - catch "after delete record"

 

 
Powered by phpBB® Forum Software