Fonction dblookup en lotusscript

Forum sur le développement Domino

Fonction dblookup en lotusscript

Postby andromeda » 10 May 2007 11:39

Code: Select all
function dblookup( db as notesdatabase, viewname as string, key as variant, resultfield as string) as variant
dim view as notesview
dim coll as notesdocumentcollection
Set view = db.getview( viewname )
dim result() as variant
dim count as long
count=0

set coll = view.getalldocumentsbykey( key, true )
redim result(coll.count)
if coll.count = 0 then
result(0)=""
else
set doc = coll.getfirstdocument()
do while not doc is nothing
result(count) = doc.getitemvalue( resultfield )
loop
end if

dblookup=result
end function
Moderator - Forum
andromeda
 
Posts: 631
Joined: 29 Mar 2004 23:07

Focntion dbcolumn en lotuscript

Postby andromeda » 10 May 2007 11:40

Code: Select all
Function dbColumn( db As NotesDatabase, viewName As String, columnNo As Integer, flgUnique As Boolean ) As Variant
'Mb¤, 30.08.2005.
'Works like @DbColumn
On Error Goto ErrHandler
Dim tmpStr As String, strDbPath As String

strDbPath = Strleftback( db.FilePath, "\" ) & "\\" & db.FileName

If flgUnique Then
tmpStr = |@Unique( @DbColumn( "" : "NoCache"; "| & db.Server & |" : "| & strDbPath & |"; "| & viewName & |"; | & columnNo & | ) )|
Else
tmpStr = |@DbColumn( "" : "NoCache"; "| & db.Server & |" : "| & strDbPath & |"; "| & viewName & |"; | & columnNo & | )|
End If

dbColumn = Evaluate( tmpStr )

Exit Function
ErrHandler:
'write your own cuz I use my function
End Function

Moderator - Forum
andromeda
 
Posts: 631
Joined: 29 Mar 2004 23:07


Return to Domino Développement

Who is online

Users browsing this forum: No registered users and 1 guest

cron