Set(Key,Key) Question 
Author Message
 Set(Key,Key) Question

I am writing a list tree screen which reads records from a main data file.  The
records is based on two primary key fields.  I wish to scan through the entries
based on these two fields.  The loop procedures shows all records, not just the
keyed ones.  Any help would be appreciated.

 Clear(PHS:Record)
 PHS:Facility=gFacility
 PHS:PatientID=gPatientID
 Set(PHS:CodeKey,PHS:CodeKey)

 Loop
   Next(PatientHistory)
   If ErrorCode() then Break.
   .. Other code....
 End



Sun, 26 May 2002 03:00:00 GMT  
 Set(Key,Key) Question
I'm guessing you only want to list the records where
PHS:Facility=gFacility and PHS:PatientID=gPatientID, if so then all you
need to do is:

  Clear(PHS:Record)
  PHS:Facility=gFacility
  PHS:PatientID=gPatientID
  Set(PHS:CodeKey,PHS:CodeKey)

  Loop
    Next(PatientHistory)
    If ErrorCode() or PHS:Facility <> gFacility or PHS:PatientID <>
gPatientID then Break.
    .. Other code....
  End

Quote:

> I am writing a list tree screen which reads records from a main data file.  The
> records is based on two primary key fields.  I wish to scan through the entries
> based on these two fields.  The loop procedures shows all records, not just the
> keyed ones.  Any help would be appreciated.

>  Clear(PHS:Record)
>  PHS:Facility=gFacility
>  PHS:PatientID=gPatientID
>  Set(PHS:CodeKey,PHS:CodeKey)

>  Loop
>    Next(PatientHistory)
>    If ErrorCode() then Break.
>    .. Other code....
>  End



Mon, 27 May 2002 03:00:00 GMT  
 Set(Key,Key) Question

Quote:
>he loop procedures shows all records, not just the
>keyed ones.  Any help would be appreciated.

The set statement as used will simply position the pointer to the first record
matching your key in key order.  It is up to the programmer to break when the
record no longer matches.  Using your example you would simply add the
following line

IF PHS:Facility <> gFacility Then Break.

right after checking the ErrorCode()



Mon, 27 May 2002 03:00:00 GMT  
 Set(Key,Key) Question
Thanks much, problem resolved.


Mon, 27 May 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. set(key, key) question

2. Set(key,key)

3. SET(Key,Key) in ABC

4. SET(Key,Key)...NEXT in Oracle

5. set(key,key)

6. SET(key,key,recnr)

7. SET(key,key) in view

8. Browse Set(Key,Key) Problem

9. F10 Key disabling the other keys

10. Problem:Want ENTER key in form to act as TAB key

11. Making return key act like tab key

12. Auto Inc Key with Must be in List Field in Multi Part Key

 

 
Powered by phpBB® Forum Software