Hi, I’m trying to get the information from the database concerning the fields included in the forms and
subforms. For all the forms, I also want to find the types of these forms.
2 solutions occurred:
First, Gets all the fields but it is impossible to get the type of field.
----code----
Sub Click(Source As Button)
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim docs As NotesDocument
Dim dTemp As NotesDocument
Dim db As NotesDatabase
Dim t As Integer
Dim Serveur As Variant
Dim NomBase As Variant
Dim x As Integer
Dim y As Integer
Dim i As Integer
Set db = Session.CurrentDatabase
'permits to be going to look for the server's name
Serveur = db.server
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
'name of the chosen base by the user
NomBase = doc.Nom_Base
'going to point on the base selected by the user
Dim dbAutre As New NotesDatabase(Serveur , NomBase(0))
'going to pass through all masks of the chosen base by the user
Forall Snogs In dbAutre.Forms
'addition of the name of fields of the mask
Call uidoc.FieldAppendText("NomMasque" , Cstr(Snogs.Name) + Chr(10))
x = 0
y = 3
'buckle that permits to be going to look for names of fields and their type of fields
On Error Goto ErreurSnogs
t = Ubound(Snogs.Fields)
On Error Goto 0
If t > 0 Then
Forall zeItem In Snogs.Fields
'going to create a document answer containing all fields of a mask
Set docs = db.CreateDocument
'going to fill fields with the gotten data
docs.Form = "InfosChamps"
docs.Nom_Base = doc.Nom_Base
docs.NomMasque = Snogs.Name
docs.ChampsMasque = Snogs.Fields(x)
'going to write down the type of fields in the variable nomchamps
Select Case docs.Items(y).Type
Case ATTACHMENT : nomchamps = "Fichier d'attachement"
Case EMBEDDEDOBJECT : nomchamps = "Objet"
Case ERRORITEM : nomchamps = "Erreur survenue quand on accède au type"
Case NAMES : nomchamps = "Noms"
Case AUTHORS : nomchamps = "Auteurs"
Case READERS : nomchamps = "Lecteurs"
Case NOTELINKS : nomchamps = "Référence à un document parent"
Case NOTEREFS : nomchamps = "Lien Doc"
Case NUMBERS : nomchamps = "Nombre ou Liste de nombre"
Case RICHTEXT : nomchamps = "Texte riche"
Case SIGNATURE : nomchamps = "Signature"
Case DATETIMES: nomchamps = "Date ou Ensemble de valeurs"
Case TEXT : nomchamps = "Texte"
Case UNAVAILABLE : nomchamps = "Non disponible"
Case UNKNOWN : nomchamps = "Inconnu"
Case USERDATA : nomchamps = "Données de l'utilisateur"
Case USERID : nomchamps = "Fichier ID de l'utilisateur"
Case Else : nomchamps = docs.Items(y).Type
End Select
'enrollment of the field type
docs.TypeChamps = nomchamps
x = x+1
'save the document containing all fields
Call docs.Save( True, False )
End Forall
End If
Call uidoc.FieldAppendtext("NomMasque" , " " + Chr(10))
End Forall
'save the document
Call doc.Save( True, True )
Exit Sub
ErreurSnogs:
t = 0
Resume Next
End Sub
Second, Cannot get all the fields but is able to get all the types of fields.
---code----
Sub Click(Source As Button)
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim docs As NotesDocument
Dim dTemp As NotesDocument
Dim db As NotesDatabase
Dim Serveur As Variant
Dim NomBase As Variant
Set db = Session.CurrentDatabase
'permits to be going to look for the server's name
Serveur = db.server
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
'name of the chosen base by the user
NomBase = doc.Nom_Base
'going to point on the base selected by the user
Dim dbAutre As New NotesDatabase(Serveur , NomBase(0))
'going to pass through all masks of the chosen base by the user
Forall Snogs In dbAutre.Forms
Set dTemp = dbAutre.CreateDocument
dTemp.Form = Snogs.Name
Call dTemp.ComputeWithForm(True, False)
'addition of the name of fields of the mask
Call uidoc.FieldAppendText("NomMasque" , "FORM : " & Cstr(Snogs.Name) + Chr(10))
Forall zeItem In dTemp.Items
'going to create a document answer containing all fields of a mask
Set docs = db.CreateDocument
docs.Form = "InfosChamps"
docs.Nom_Base = doc.Nom_Base
docs.NomMasque = Snogs.Name
docs.ChampsMasque = zeItem.Name + Chr(10)
'enrollment of the field name in the NomMasque fields
'Call uidoc.FieldAppendText("NomMasque" , "Champs : " & Ucase(zeItem.Name) & " : ")
'write down a message according to the type of fields
Select Case zeItem.Type
Case ATTACHMENT : nomchamps = "Fichier d'attachement"
Case EMBEDDEDOBJECT : nomchamps = "Objet Embedded "
Case ERRORITEM : nomchamps = "Erreur occurred while accessing type"
Case NAMES : nomchamps = "Noms"
Case AUTHORS : nomchamps = "Auteurs"
Case READERS : nomchamps = "Lecteurs"
Case NOTELINKS : nomchamps = "Référence à un document parent"
Case NOTEREFS : nomchamps = "Lien Doc"
Case NUMBERS : nomchamps = "Nombre ou Liste de nombre"
Case RICHTEXT : nomchamps = "Texte riche"
Case SIGNATURE : nomchamps = "Signature"
Case DATETIMES: nomchamps = "Date ou Ensemble de valeurs"
Case TEXT : nomchamps = "Texte ou liste de texte"
Case UNAVAILABLE : nomchamps = "Non disponible"
Case UNKNOWN : nomchamps = "Inconnu"
Case USERDATA : nomchamps = "Données de l'utilisateur"
Case USERID : nomchamps = "Fichier ID de l'utilisateur"
Case Else : nomchamps = zeItem.Type
End Select
'enrollment of the field type
docs.TypeChamps = nomchamps + Chr(10)
' Call uidoc.FieldAppendtext("NomMasque" , espace & Ucase(nomchamps) & Chr(10))
Call docs.Save( True, False )
End Forall
Call uidoc.FieldAppendtext("NomMasque" , Chr(10))
End Forall
'save document
Call doc.Save( True, True )
End Sub
Can you help me ?
Thanks a lot.

How to recover all masks and fields... (Clode Berube 21.Jul.03)
. . 