[REBOL] Re: Rebodex database question
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
> "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"
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