Can someone help me to convert this @formula code to LotusScript

Can someone help me to convert this @formula code to LotusScript.

REM {assign item numbers};

FIELD Hours := “”;

numItems := @Elements(DateReqFormat);

txtIntegers10 := “0” : “1” : “2” : “3” : “4” : “5” : “6” : “7” : “8” : “9”;

txtIntegers100 := txtIntegers10 *+ txtIntegers10 ;

txtIntegers99 := @Subset( txtIntegers100 ; -99);

FIELD ItemL := @Subset( txtIntegers99 ; numItems );

@For(n := 1;

n <= numItems; n := n + 1;

FIELD Hours := @Trim(Hours:“8”));

Subject: Can someone help me to convert this @formula code to LotusScript.

Welcome to LotusScript!

Off the top of my head… I haven’t tested it, so it might not work. You need to a variable of doc to be the NotesDocument object.

So, in QuerySave:

Call SetItemLAndHours(source.document)

in an agent

dim session as New NotesSession

dim db as NotesDatabase

dim doc as NotesDocument

dim col as NotesDocumentCollection

set db = session.CurrentDatabase

set col = db.UnprocessedDocuments

set doc = col.GetFirstDocument

do until doc is nothing

Call SetItemLAndHours(doc)

set doc = col.GetNextDocument(doc)

Loop

function SetItemLAndHours(doc as NotesDocument)

dim asItemL() as string

dim asHours() as string

dim i as integer

dim u as integer

u = ubound(doc.DateReqFormat)

if u = 0 and len(doc.DateReqFormat(0)) = 0 then

doc.ItemL = “”

doc.Hours = “”

else

redim asItemL(u)

redim asHours(u)

for i = 0 to u

asItemL(i) = i + 1

asHours = “8”

Next

end if

end function