Ingo,
This was a great idea, and it seems to have solved my problem!
I changed the load-data function as follows:
load-data: has [data] [
if exists? db-file [
data: reduce load/all db-file
clear database
if data [
foreach item data [
item: make record item
repend database [join item/code item/chknum item] ; <==<<<
ONLY THIS LINE CHANGED.
]
]
database: make hash! database
]
]
Then, search for the unique record as follows:
rec: find database join code chknum
I tested it on several records, and it seems to work perfectly.
Many thanks!
Louis
At 10:40 AM 4/15/2002 +0200, you wrote:
>Hi Louis,
>
>Dr. Louis A. Turk wrote:
><...>
>>What I am wanting to do is to make sure that the record is not already in
>>the database before I insert it. In other words, no duplicate _records_
>>are allowed. Note, however, that although the records are all unique,
>>the code data is not necessarily unique, nor is the chknum data. There
>>may be many records with the same code, and also many records with the
>>same chknum. Only the code / chknum combination is unique.
>>So, do I perhaps need the records to look like this?:
>> ] "bho" "5259" ; <===<<< TWO KEYS.
>> make object! [
>> code: "bho"
>> chknum: "5259"
>> date: 27-Jul-2001
>> amount: $100.00
>> special: $0.00
>
>well, I think this would get you into much trouble, but how about using a
>single key, that joins the two values?, e.g.
>
> >> key: join join code "-" chknum
> == "bho-5259"
>
>and then use
>
> ] "bho-5259" ; <===<<< ONE KEY, composed of TWO KEYS.
> make object! [
> code: "bho"
> chknum: "5259"
> date: 27-Jul-2001
> amount: $100.00
> special: $0.00
>
>I hope that helps,
>
>Ingo
>
>
>
>--
>To unsubscribe from this list, please send an email to
>[EMAIL PROTECTED] with "unsubscribe" in the subject, without the quotes.
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.