Issue with determining if field is empty in Lotus Script

All,

I have some lotus Script that is supposed to run only if a certain field is filled in. The script is basically creating a mail send using the Principal field. However, I have been unsuccessful in getting the code to run like I want it to as opposed to like it must be coded.

What I want it to do and thought it should do is to check to see if the field on the uidoc named ECONumber is filled in. If it is empty a Messagebox is to pop up and say you can’t do this then the agent stops. If the field is not empty it just continues on happily creating the mail message and filling in other items on it’s way.

What it is doing is not throwing any codes, and steps down to the End IF and regardless if the field is filled in.

Here is the part that is not working:

Dim checkit As Variant

checkit = uidoc.FieldGetText("ECONumber")



If Isempty(checkit) Then

	'do something

	boxType& = MB_OK + MB_ICONSTOP

	answer% =Messagebox("You can not route a part for approval unless you have an ECO number.", boxType&,  "No ECO Number")

	End

Else

	

	'do something else

End If

I have tried it with the following (I used “”, >, and < at different times) – This will stop the code regardless if the field is filled in or not.:

If uidoc.FieldGetText(“ECONumber”)(0) = “” Then

	'do something

	boxType& = MB_OK + MB_ICONSTOP

	answer% =Messagebox("You can not route a part for approval unless you have an ECO number.", boxType&,  "No ECO Number")

	End

Else

	

	'do something else

End If

So, Can someone point me in the correct direction? Thanks for any and all help.

Teri

Subject: Issue with determining if field is empty in Lotus Script

You are already converting it to text so you can do a simple

if checkit = “” then

Subject: RE: Issue with determining if field is empty in Lotus Script

Thanks Marjan,

Worked like a charm.

Perhaps you can answer another question I have. At times I will have a button where I will run some formula’s to include an @command(RunAgent…). However, I find that on some of them they give me an error that my document has not been saved. Do you have any clue what that might be about off the top of your head? As long as I put in an @command(save) before running the agent it runs fine.

Thanks

Teri

Subject: RE: Issue with determining if field is empty in Lotus Script

That is exactly the problem some commands you cannot execute when the document has not been saved.

Subject: RE: Issue with determining if field is empty in Lotus Script

Teri

On the dialog box you see when you open the agent in designer try setting the Target dropdown to none.

You will still be able to get hold of the uidoc using uidoc = workspaces.CurrentDocument

HTH

John