Bonjour,
Est-il possible (en lotusscript ) de connaitre dans le document en cours :
- Le nombre de champs
- Leurs noms
- Leurs valeurs
j'ai parcourue l'aide du desiner ainsi que le net, mais sans résultat.
Cordialement
Jordane.
Function FieldList(wDB As NotesDatabase, wForm As String, wDoc As NotesDocument) As Variant
'Déclaration de variables
Dim lstValue List As String
Dim Selection As String
Dim i As Integer
Dim DB2 As NotesDatabase
Dim FRM As NotesForm
Dim vrItem As Variant
On Error Goto ErreurHandle
Erase lstValue
lstValue(0) = ""
i = -1
If Trim(wForm) = "" And (wDoc Is Nothing) Then
FieldList = lstValue
Erase lstValue
Exit Function
Elseif Trim(wForm) <> "" And (Not wDoc Is Nothing) Then
FieldList = lstValue
Erase lstValue
Exit Function
End If
If wDB Is Nothing Then
Set Session = Nothing
Set Session = New NotesSession
Set Db2 = Session.CUrrentdatabase
Else
Set Db2 = wDB
End If
If Trim(wForm)<>"" Then
'recherche sur un masque/form
Set FRM = Db2.GetForm( Trim(wForm) )
If FRM Is Nothing Then
' Mess = "Formulaire introuvable.",48," ATTENTION !"
FieldList = lstValue
Erase lstValue
Exit Function
End If
Forall Value In FRM.fields
i = i+1
lstValue(i) = Value
End Forall
Else
'recherche sur un document
If wDoc Is Nothing Then
' Mess = "Document is nothing",48," ATTENTION !"
FieldList = lstValue
Erase lstValue
Exit Function
Else
vrItem = wDoc.Items
Forall value In vrItem
i = i+1
lstValue(i) = Value.name
End Forall
vrItem = Null
End If
End If
i = 0
Selection = ""
FieldList = lstValue
Erase lstValue
Set Db2 = Nothing
Exit Function
ErreurHandle:
Msgbox "("+Structure_Log+" : "+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
lstValue(0) = ""
FieldList = lstValue
Erase lstValue
Exit Function
End Function Dim Doc As NotesDocument
Dim item As NotesItem
Dim nbfield As Integer
nbField = Ubound(Doc.Items)
Msgbox "nb fields : "+Cstr(nbField)
Forall value In Doc.Items
Set Item = value
Msgbox "Champ : "+Item.Name+Chr(10)+"Valeur : "+item.Text
End Forall