Optimize your Lotus Script with Evaluate function – Lotus Script

At times we would be in a situation to optimize the lotus script code or reduce the number of lines in code or increasing the performance of our lotus script code or agent.

We may have written many lines of code for a functionality whereas, the same functionality can be written in few lines of code using formula language. Say for example, you have a text list field and wanted to find a specific value present in that text list field and you have to do it in lotus script. Luckily we have a lotus script function EVALUATE to execute some formula code.

It executes the formula and returns the result as array. It is very useful when working with text list fields and formula like @isMember, @sort, @replace, @replacesubscript, @left, @right, @middle, @unique and functionality like joining two array or text list, performing some string operations within the array or text list fields.

vResult = Evaluate ( "@IsMember ('Apple' ; 'Apple' : 'Banana' : 'Carrot')" )
vResult = Evaluate ( {@IsMember ("Apple" ; "Apple" : "Banana" : "Carrot")} )
doc.List = Evaluate ( {@Unique(List : NewItem)}, doc)
Dim s As New NotesSession
Dim doc As NotesDocument
Set doc = s.CurrentDatabase.CreateDocument
doc.tempCompany = "Lotus"
vResult = Evaluate ( {@IsMember (tempCompany ; "Lotus" : "IBM" : "Microsoft")}, doc)
Msgbox vResult(0)

Leave a Reply

Your email address will not be published. Required fields are marked *