Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Rebodex database question

 [1/3] from: gschwarz::netconnect::com::au at: 27-May-2001 20:28


Rebodex (by Carl) stores the data in blocks as below. REBOL [Title: "Name Database" Date: 27-May-2001/20:05:24+10:00 ] [ [name "Carl Sassenrath" title "Founder" company "REBOL Technologies" email [carl--rebol--com] web "http://www.rebol.com"] [name "Greg" company "Hope have one....." title "Human" updat 27-May-2001/20:05:07+10:00 cell "538658385"] [name "Joe Blow" title "Big Wig" work "8653800" car "65865800" fax 65380000 updat "27-May-2001/20:04:35+10:00"] ] data-line: first names-path ; names-path points to the above database. If we put the first block into data-line we can get the following infomation, data-line/name "Carl Sassenrath" and data-line/company "REBOL Technologies." What I would like to is read the data base for some data fields, say name and company. But not all blocks of data will have a company field. How do you test for data-line/company without getting an error? Script Error: Invalid path value: company Regards, Greg (I know I have the answer somewhere in my Rebol books, but blindness gets me on this one!)

 [2/3] from: gjones05:mail:orion at: 27-May-2001 6:33


From: "Gregory Schwarz" To: <[rebol-list--rebol--com]> Sent: Sunday, May 27, 2001 5:28 AM Subject: [REBOL] Rebodex database question
> Rebodex (by Carl) stores the data in blocks as below. > > REBOL [Title: "Name Database" Date: 27-May-2001/20:05:24+10:00 ] > [ > [name "Carl Sassenrath" title "Founder" company "REBOL Technologies"
email
> "[carl--rebol--com]" web "http://www.rebol.com"] > [name "Greg" company "Hope have one....." title "Human" updat
<<quoted lines omitted: 3>>
> ] > data-line: first names-path ; names-path points to the above
database.
> If we put the first block into data-line we can get the following > infomation, > data-line/name "Carl Sassenrath" > and > data-line/company "REBOL Technologies." > > What I would like to is read the data base for some data fields, say
name
> and company. But not all blocks of data will have a company field. > How do you test for data-line/company without getting an error? > > "Script Error: Invalid path value: company"
data-path: [ [name "Carl Sassenrath" title "Founder" company "REBOL Technologies" email [carl--rebol--com] web "http://www.rebol.com"] [name "Greg" company "Hope have one....." title "Human" updat 27-May-2001/20:05:07+10:00 cell "538658385"] [name "Joe Blow" title "Big Wig" work "8653800" car "65865800" fax 65380000 updat "27-May-2001/20:04:35+10:00"] ] ;to print name and company to be sure it accesses correctly foreach data-line data-path [print [select data-line 'name select data-line 'company]] ;only prints name company if company is not none foreach data-line data-path [if select data-line 'company [print [select data-line 'name select data-line 'company]]] --Scott Jones

 [3/3] from: gschwarz:netconnect:au at: 27-May-2001 23:11


Scott, Thank you very much, just what I needed. Regards, Greg

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted