Skip to main content

Export Field names and Field types to excel

                Dim session As New NotesSession
                Dim uiWs As New NotesUIWorkspace
                Dim uiDoc As NotesUIDocument
                Dim db As NotesDatabase
                Dim serverName, dbName As String
                Dim formDataType As NotesForm
                Dim msgFormVar As Variant
                Dim msgForms List As String
                Dim msgArray() As String
                Dim formNameln As Variant
                Dim fieldCount As Integer
                Dim msgString As String
               
               
                formCount = 0
                msgString = ""
               
                Set uiDoc = uiWs.CurrentDocument
                serverName = uiDoc.FieldGetText("fldServername")
                dbName = uiDoc.FieldGetText("fldDatabasename")
                Msgbox serverName & dbName,,"DB details"
                Set db = session.GetDatabase(serverName,dbName)
                If db.IsOpen Then
                                Print( "Succesfully opened " & db.Title )
                Else
                                Messagebox "Please select the database", , "Database not selected"
                                Exit Sub
                End If
                Forall form In db.Forms
                                formCount = formCount + 1
                                msgString = msgString & Chr(10) & "     " & form.Name
                                'Msgbox formCount
                                msgForms(formCount) = form.Name
                                msgFormVar= msgForms
                               
                End Forall
                Messagebox "This database has " &  formCount & " forms:" & msgString
                Redim msgArray(formCount)
                'Msgbox msgFormVar
               
                For i =1 To formCount
                                msgArray(i) = msgFormVar(i)
                Next
               
'               Msgbox Ubound(msgArray)
               
                'Exit Sub
                '------------------------------------
                'formNameIn = Lcase(Inputbox("Name of form?"))
                formNameln = uiWs.Prompt (PROMPT_OKCANCELCOMBO, "Select a form",       "Select a form to open.", msgArray(1),msgArray)
               
                If Isempty (Trim(formNameln)) Then
                                Messagebox "Canceled", , "Form not selected"
                                Exit Sub
                End If
               
                If Trim(formNameln)="" Then
                                Messagebox "Canceled", , "Form not selected"
                                Exit Sub
                End If
               
                Dim ObjExcel As Variant 'Excel Object
                Set ObjExcel = CreateObject("Excel.Application")
                ObjExcel.Visible = True 'make sure the Excel sheet is visible
                Call ObjExcel.Workbooks.add 'to create new worksheet
               
               
                Set formDataType = db.GetForm(formNameln)
                Forall form In db.Forms
                                If Lcase(form.Name) = Lcase(formNameln) Then
                                                If Isempty(form.Fields) Then
                                                                Messagebox form.Name & " has no fields"
                                                Else
                                                               
                                                                fieldCount = 0
                                                                msgString = ""
                                                                i=2
                                                                Forall field In form.Fields
                                                                                fieldCount = fieldCount + 1
                                                                                Select Case formDataType.GetFieldType(field)
                                                                                Case AUTHORS : fieldType = "Authors"
                                                                                Case DATETIMES : fieldType = "DateTime"
                                                                                Case NAMES : fieldType = "Names"
                                                                                Case NUMBERS : filedType = "Number"
                                                                                Case READERS : fieldType = "Readers"
                                                                                Case RICHTEXT : fieldType = "Rich text"
                                                                                Case TEXT : fieldType = "Text"
                                                                                Case Else
                                                                                                fieldType = "Other " & formDataType.GetFieldType(field)
                                                                                End Select
                                                                               
                                                                               
                                                                               
                                                                                msgString = msgString & Chr(10) &           "     " &  field &" - "& fieldType
                                                                                ObjExcel.Cells(1,1).value="Field Type"
                                                                                ObjExcel.Cells(1,2).value="Field Type"
                                                                                ObjExcel.Cells(i,1).value=field
                                                                                ObjExcel.Cells(i,2).value=fieldType
                                                                                'ObjExcel.Cells(i,3).value=doc.LastModified
                                                                                i=i+1
                                                                End Forall
                                                                'ObjExcel.Visible = False
                                                                'Messagebox form.Name & " has " &      fieldCount &      " field(s):" & Chr(10) & msgString

                                                End If

Comments

Popular posts from this blog

"Error in Agent" or "Error loading USE or USELSX" running Out-of-Office agent after upgrading to Domino 6.x

Question After upgrading from one Lotus® Domino® server version to another (for example, 5.0.11 to 6.x), you find that the Out of Office agent does not work and produces errors written to the console and the log (if enabled). The error message in the Domino console is as follows: "Error in Agent ´OutOfOffice OutOfOffice´ calling script library ´Common´: Script library signer ´CN=ServerA/O=Widgets´ does not have proper rights Agent ´OutOfOffice OutOfOffice´ error: Error loading USE or USELSX module: Common AMgr: Agent ´outofoffice´ in ´mail\jdoe.nsf´ completed execution" Maintenance on the database did not resolve the problem, nor did replacing the design or running fixup, updall -r, or compact. Answer Agent security rights in Domino 6.0 were revised to be more robust. This issue occurs when the signer of the script library does not have the correct rights to execute on the Domino server, and/or the script library has not been signed in Notes/Domino 6...

Lotusscript to establish ODBC connection:

The script, when executed from a button, will create a new record in a specified ODBC data source, attempt to save the new record and display a message indicating whether the operation was completed successfully. If the operation is not completed sucessfully, it is likely that either your data source is read-only or your ODBC driver does not permit updates to the data source. Important: Complete each of the four steps below before running the script. 1. Create a new agent and add the following UseLSX command to the Options event: UseLSX "*LSXODBC" 2. Add the following script to the Initialize event of the agent. NOTE: Do not add the 'Sub' and 'End Sub' lines. Dim ui As New NotesUIWorkspace     Dim uidoc As NotesUIDocument     Dim doc As NotesDocument     Dim connection As ODBCConnection     Dim query As ODBCQuery     Dim result As ODBCResultSet         Set uidoc=ui.CurrentDocument ...

"Responses" and "Response to responses"

Lotus Notes has any kind of format of lotus notes document, but what about the “response” and “response to the response.” When you design the form in lotus notes application you can chosen: to create a document with the document format under the primary documents call “response document” or create a document under response documents call “response to the response.” Lotus notes develops can decide whether to provide some structure when you create notes documents. There are many cases that are more relevant documents are clear. Example: a data entry in a document, you can information to employees in the two documents to be attached to the first. Remember that you have entered in the accounting documents of each set a unique ID.  How to tie documents to respond to the main document is to add a field in response documents called $REF. $REF argues that ID is not taken into account. copies of the parent. How “responses” differ from “response to responses”? Do you have a hierarchy of do...