Anton,
Thanks for the help. Further testing proved that you are right about my
code being incorrect. However, when I try
find database/2 chknum
I get the following error message:
Code: boo
Check#: 9898
** Script Error: find expected series argument of type: series port bit
set
** Where: forever
** Near: rec: all [find database code find database/2 chknum]
either rec
>>
Here is the the code from my program:
if choice = #"1" [
forever [
print cls
print " ADD A RECORD"
print " ============^/"
code: ask " Code: "
chknum: ask " Check#: "
if code = "" [break] ;gsj added to avoid empty error
rec: all [find database code find database/2
chknum]
either rec = none [
date: ask " Date: "
amount: ask " Amount: "
special: ask " Special Offering: "
insert-data code chknum date amount special
save-data
][
ask "^/ Record is already in database. Continue? "
]
] ; End forever loop for choice 1
] ; End if choice 1
Thanks again,
Louis
At 03:42 PM 4/13/2002 +1000, you wrote:
>No, adding copy didn't fix your code.
>Removing the 2 did. (Although, I am not really
>sure it is fixed...)
>The problem is that find takes two arguments,
>not three, as you seem to think in this line:
>
> find database 2 chknum
>
>This just returns the value of chknum.
>You had obviously set chknum sometime in your testing
>on the console. I'll put brackets to show how the
>above line was evaluated:
>
> (find database 2) (chknum)
>
>The first value returns none, the second value returns
>"9898", which must have been what you set it to at
>some point.
>
>In the 'all block, you actually had three values to
>check, not two, as I am sure you thought you had:
>
> rec: all [find database code find database 2 chknum]
>
>I will put brackets to show how it was evaluated.
>
> rec: all [(find database code) (find database 2) chknum]
>
>So 'all would have returned at the second value (none).
>
>Perhaps you meant to write:
>
> find database/2 chknum
>
>That means to look in the second value of the hash!
>
>Anton.
>
> > I found the solution---add the word copy.
> >
> > rec: all [find database code copy (find database chknum)]
> >
> > For some reason I keep having to learn that lesson again and again. :>)
> >
> > Louis
> >
> > At 02:43 PM 4/12/2002 -0500, you wrote:
> > >Rebol friends,
> > >
> > >I have the following line of code to check to make sure that a
> > record does
> > >not already exist, but it always returns none:
> > >
> > >rec: all [find database code find database chknum]
> > >
> > > >> find database code
> > >== make hash! ["boo"
> > > make object! [
> > > code: "boo"
> > > chknum: "9898"
> > > date: 19-Jan-2001
> > > amount: $100....
> > > >> find database 2 chknum
> > >== "9898"
> > > >> rec: all [find database code find database 2 chknum]
> > >== none ; Why is this none????????????????
> > >
> > >Futher testing shows where the failure is happening:
> > >
> > > >> rec: all [find database code]
> > >== make hash! ["boo"
> > > make object! [
> > > code: "boo"
> > > chknum: "9898"
> > > date: 19-Jan-2001
> > > amount: $100....
> > > >> rec: all [find database 2 chknum]
> > >== none
> > > >> find database 2 chknum
> > >== "9898"
> > > >> all [find database 2 chknum]
> > >== none
> > > >> find database 2 chknum
> > >== "9898"
> > > >>
> > >
> > >Why?
> > >
> > >Louis
>
>--
>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.