Subroutines and functions in agent

Can anyone tell me how to write subroutines and functions in agents .i am new to lotus notes i am a developer just joined a company very help me.

simran

Subject: Subroutines and functions in agent

Simran,

A subroutine would start with “Sub” and a function woudl start with “Function” with the relevant parameters

eg:

Sub PrintName (strName as string)

Print strName

End Sub

The subs and functions can then be called within other code (read up on scope as this is a bit of a loose comment by me!)

eg:

Dim strUserName as String

strUserName=“Joe Bloggs”

PrintName strUserName

The difference with a function is that it returns a value and usually therefore has a datatype associated

eg:

Function TotalAmount (intAmount1 as integer, intAmount2 as integer) as integer

TotalAmount=intAmount1+intAmount2

End Function

Good luck!

Mike

Subject: RE: Subroutines and functions in agent

And just in case that this was the motivation for the question:

To create a new procedure, simply type

Sub MySubName

and hit enter. Designer will create the new section and display it in the objects pane.

Subject: RE: Subroutines and functions in agent

thanks harkpapst i really liked ur procedure

thanks

Subject: RE: Subroutines and functions in agent

thanks mike but where i will write these functions and subs

Subject: RE: Subroutines and functions in agent

Create your agent, ensure “LotusScript” is selected in the drop down list (it usually defaults to “Simple action”)

When the agent is run, the code in the “Initialize” event will run

You can create subs and functions within this code and the IDE will separate them out

You can also use Options and Declarations to include script libraries/external files etc

Subject: RE: Subroutines and functions in agent

Thanks mike it was a great help