Script problem

Hi friends,

i have small problem with lotus script please see the code below error is type mismatch.

i am getting the document handle .

Here i am writing multiple if conditions all are date/time fields

so i tried cdat(vwdoc.c_date1(0) <> “” & cdat(vwdoc.c_date2(0) = “” ) and tried to convert to string also using cstr() but every time the same error i am fed up with this screen whole this evening any body pleae help me out

If Not vwdoc Is Nothing Then

	If ((vwdoc.c_date1(0)) = "") Then

		Call doc.ReplaceItemValue("status","SPEC")

	End If

	If (((vwdoc.c_date1(0)) <> "" )  & ((vwdoc.c_date2(0))="" )) Then <---- on this line error type mismatch ---->

		Call doc.ReplaceItemValue("status","TEND")

	End If

	If ((vwdoc.c_date2(0)) <> "" ) & ((vwdoc.bids(0))="" ) Then

		Call doc.ReplaceItemValue("status","BIDS")

	End If

	If ((vwdoc.bids(0)) <> "") & ((vwdoc.c_date3(0))="") Then

		Call doc.ReplaceItemValue("status","NEG")

	End If

	If ((vwdoc.c_date3(0)) <> "") & ((vwdoc.c_date4(0))="") Then

		Call doc.ReplaceItemValue("status","EPC")

	End If

	If ((vwdoc.c_date3(0)) <> "") & ((vwdoc.c_date4(0))="") Then

		Call doc.ReplaceItemValue("status","EPC")

	End If

	If ((vwdoc.c_date4(0)) <> "") &( (vwdoc.epc(0))="") Then

		Call doc.ReplaceItemValue("status","EPA")

	End If

Subject: script problem

Hi Suman,

You are using the ‘&’ - sign where you should use AND.

The ‘&’-sign puts two variables together and returns a string.

So

if (((vwdoc.c_date1(0)) <> “” ) & ((vwdoc.c_date2(0))=“” )) Then

is seen as

if “TrueTrue” then

and that generates a type mismatch

And I would use the Cstr function to be sure you compare a string with a string.

If Cstr(vwdoc.c_date1(0)) = “” Then

Call doc.ReplaceItemValue(“status”,“SPEC”)

End If

If Cstr(vwdoc.c_date1(0)) <> “” AND Cstr(vwdoc.c_date2(0))=“” Then

Call doc.ReplaceItemValue(“status”,“TEND”)

End If

Etc.

Regards,

René

Subject: RE: script problem

Thanks Rene,

Now it is working fine

Subject: script problem

Take a look at IsDate in the help file to see if that helps.

Subject: script problem

& - merges two strings “A” & “B” = “AB”

AND - is the logical operator that compares

You probably have a conflict between the data types returned by each comparison () in yr statement.