home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #3 / amigamamagazinepolishissue1998.iso / bazy / db3.4 / examples / relations / cd-songs.db < prev    next >
Text File  |  1997-03-16  |  920b  |  41 lines

  1. /* Relational look-up
  2.  * ARrexx script for db showing how simple relations can be implemented.
  3.  * By David Ekholm 1995 
  4.  * $VER: look-up.db 1.0 (13.9.95)
  5.  *
  6.  * To create your own relations, just modify the two lines below
  7.  */
  8.  
  9. file = 'Songs'
  10. key = 'CD #'
  11.  
  12. /* 'file' indicates what file to do the look-up in. 'key' is the field to
  13.  * look into. This scripts expects the portname to be 'file'.1
  14.  * It also assumes the key fieldname to be the same in the two databases.
  15.  */
  16.  
  17. port = file || '.1'
  18.  
  19. Options Results
  20.  
  21. GetField key
  22. keyval = result
  23.  
  24. if find(show('p'), port) == 0 then do
  25.     address command 'run //db ' file
  26.     address COMMAND WaitForPort port
  27.     ActivateWindow     /* Reactivate the old window */
  28. end
  29.  
  30. address VALUE port
  31. BlockInput    /* Do this silently */
  32. Mode 'find'
  33. Kill
  34. CurrentField key
  35. PutField keyval
  36. FindFirst
  37. if RC == 5 then do 
  38.     DisplayBeep
  39.     Okay1 key keyval 'can''t be found in the ' file 'database!'
  40. end
  41. FreeInput