Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Comparing strings in Lotus Script: Why doesn't this work?

1,455 views
Skip to first unread message

David

unread,
Jan 29, 1999, 3:00:00 AM1/29/99
to
Hi everyone,
I am a compelte newbee to LotusScript and I'm having a rough time trying
to compare the value of two text fields in two separate databases and
act upon the outcome of the comparison.
In one DB I have the "where" field that I want to compare to the
"adress" field of another DB. I have tried everything but the "if"
statement just doesnt work.
This is just one of the variants I tried:
"If FirstDB.where Like secondDB.adress Then Call
message.Send(False,"John Smith")"
I tried to debugg using "messagebox(firstDB.where)" to see if the script
managed to print the string on screen, but all I got was a "Type
mismatch error" (I am *sure* that the fields are normal textfields...).
Could anyone give a hand, please?
David Palm
Municipality of Bologna

P.S. I'm using Lotus Notes 4.63a


David

unread,
Jan 29, 1999, 3:00:00 AM1/29/99
to

David Launen

unread,
Jan 29, 1999, 3:00:00 AM1/29/99
to
It looks as if you have not declared the notes document you are working on
for that variable (I don't know if that the exact way to explain the
problem, but I know whats wrong). Basically try something like this... it
looks as if your going through the back end... is that right?

dim db as NotesDatabase
dim db2 as New NotesDatabase("ServerName","Database.nsf")
dim view as NotesView
dim view2 as NotesView
dim session as New NotesSession

***Look Here ****
dim doc as NotesDocument
dim doc2 as NotesDocument
********************

dim strWhere as string
dim strAddress as string

set db = session.currentdatabase
set view = db.getview("YourFirstView")
set doc = view.GetFirstDocument

view = db2.GetView("YourSecondView")
set doc2 = view.GetFirstDocument

strWhere = doc.where(0)
strAddress = doc2.address(0)

If strWhere = strAddress then
.... enter your script here.....
Else
MsgBox "The person who justed posted this script is an idiot"
End if


Hope this helps

Lugin

Svatos Coufal

unread,
Jan 30, 1999, 3:00:00 AM1/30/99
to David
Hi David

> I tried to debugg using "messagebox(firstDB.where)" to see if the
> script
> managed to print the string on screen, but all I got was a "Type
> mismatch error" (I am *sure* that the fields are normal
> textfields...).

Small tip - the most (any ?) document field you access in scriptare a
arrays. No mather how many items it has or if multiple values are
alowed. For getting all values use a variant variable and for the first
one only the syntax:"messagebox(firstDB.where(0))"

To put one value in a document field use doc.fieldname = "Value", for
value of an other type or multiple values use a variable or array.

Svatos

David

unread,
Feb 1, 1999, 3:00:00 AM2/1/99
to
You were perfectly right. It was the only error present in my script. It
was great seeing the bastard starting up and doing *exactly* what it was
supposed to. I thank you *very* much for helping me out of the impasse.
Thanks again. Thanks.
The Lotus documentation is SO lousy; it was actually impossible to find an
example of string comparsion in the doc DBs...

Do you have any ideas for a good and thorough LotusScript book? Or should I
go for Java instead.
David

0 new messages