| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > FileManager > FileManager Methods >====== Fetch (get a specific record by key value) {{c6h0009.jpg|C6H0009.jpg}} ====== | [[equalbuffer detect record buffer changes .htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[getcomponents return the number of key components .htm|{{btn_next_n.gif|Next page}}]] | | || **Fetch( **//key //**), VIRTUAL, PROC** {{blk2blue.jpg|blk2blue.jpg}} | **Fetch** | Gets a specific record by its key value and handles any errors. | | //key// | The label of the primed KEY. | The **Fetch **method gets a specific record by its key value and handles any errors. You must prime the key before calling Fetch. If the key is not unique, Fetch gets the first record with the specified key value. The TryFetch method provides a slightly different (manual) alternative for fetching specific records. **Implementation: **Fetch tries to get the specified record. If it succeeds, it returns Level:Benign (declared in ABERROR.INC). If it fails, it returns Level:Notify (also declared in ABERROR.INC) and //clears the record buffer//. See //Error Class //for more information on severity levels. **Return Data Type:**     BYTE **Example:** ** PROGRAM** ** INCLUDE('ABFILE.INC')             !declare FileManager class** ** MAP                               !program map** ** END** **GlobalErrors  ErrorClass           !declare GlobalErrors object** **Access:States  CLASS(FileManager)  !declare Access:States object** **         END** **States     FILE,DRIVER('TOPSPEED'),PRE(ST),CREATE,BINDABLE,THREAD** **StateCodeKey KEY(ST:StateCode),NOCASE,OPT,PRIMARY** **Record       RECORD,PRE()** **StateCode     STRING(2)** **State         STRING(20)** **             END** **           END** ** CODE** ** !program code** ** !get the state record for Florida** ** ST:StateCode = 'FL'                     !prime the state key for the fetch** **Access:States.Fetch(ST:StateCodeKey)    !fetch the record and handle any errors** **See Also:**     [[tryfetch try to get a specific record by key value .htm|TryFetch]]