Domino 9 und frühere Versionen > Entwicklung

periodischer Export in "structured text", wenn bestimmtes Flag gesetzt

(1/2) > >>

HeiCore:
Hallo!

Wie kann ich per Agenten periodisch Dokumente aus einer Ansicht mit einem bestimmten "Flag" in eine csv-Datei schreiben?

Danke schonmal. ???

 ???

my head:
wie möchtest du die daten in die *.csv bringen über excel...

wenn ja, kann ich dir ein script posten...

HeiCore:
Ja, zum Beispiel!

my head:
hier ist export-script von mir:

Sub Initialize
'****************************************************************************************************   
'VARIABLEN   
'****************************************************************************************************   
   'hilfsvariablen
   
   Dim firma As String
   Dim abt As String
   Dim countFIRMA As Integer
   Dim countAbt As Integer
   Dim nvStatus As Integer
   Dim i As Integer
   Dim j As Integer
   
'***********************************************
   'EXCEL-DATEI               
   Dim xlFilename As String      
   xlFilename = "C:\test1.xls"                              
'***********************************************
   Dim Excel As Variant
   Dim xlWorkbook As Variant
   Dim xlSheet As Variant
   Dim row As Integer
   Dim column As Integer
   
    'Excelverbindung   
   Print "Verbindung zu Excel wird aufgebaut..."
   Set Excel = CreateObject( "Excel.Application.9" )   
   Excel.Visible = False '// -> Excel nicht sichtbar
   Excel.Workbooks.Open xlFilename 'Excel-Datei öffnen
   Set xlWorkbook = Excel.ActiveWorkbook
   Set xlSheet = xlWorkbook.ActiveSheet
   column = 1
   row = 1
   
   'LOTUS_NOTES
   Dim session As New NotesSession
   Dim db As NotesDatabase
   Dim view As NotesView
   Dim doc As NotesDocument
   Dim entry As NotesViewEntry
   
   Set db = session.CurrentDatabase
   Set view = db.GetView("uebersicht")
   Set collection = view.AllEntries
   Set entry = collection.GetFirstEntry   
   Set doc = entry.Document
'*****************************************************************************************************   
   
'****************************************************************************************************
'EXCEL-INHALTE LÖSCHEN
'****************************************************************************************************
   Call designdelete(excel,xlsheet)
   Call designbuild(excel,xlsheet,row,column,69,0)
'****************************************************************************************************
   
'****************************************************************************************************   
'EINLESEN:
'****************************************************************************************************
   'EinleseSchleife
   Print "Daten werden eingelesen..."   
   While Not (entry Is Nothing)
      countFIRMA = 0
      firma = doc.txtFirma(0)
      With xlSheet
         xlSheet.Cells(row,column).Select
         Excel.Selection.Font.Bold = True   
         Excel.Selection.Font.Size = 10
         .Cells(row,column).Value = doc.txtFIRMA(0)   
         row = row +1         
         If doc.txtFirma(0) <> "FIRMA Hauptsitz" Then
            xlSheet.Cells(row,column).Select
            Excel.Selection.Font.Bold = True   
            Excel.Selection.Font.Size = 10
            .Cells(row,column).Value = "Vollwahl: "&doc.txtvollwahl(0)
            row = row +1
            xlSheet.Cells(row,column).Select
            Excel.Selection.Font.Bold = True   
            Excel.Selection.Font.Size = 10
            .Cells(row,column).Value = doc.txtkurzwahl(0)   
            row = row +1
            Call designbuild(excel,xlsheet,row-3,column,row-1,"bgcolor")
         Else
            Call designbuild(excel,xlsheet,row-1,column,row-1,"bgcolor")
         End If
         While (firma = doc.txtfirma(0))
            countAbt = 0
            nvStatus = 0
            abt = doc.txtAbt(0)   
            If (doc.txtAbt(0) <> "allgemein") Then
               If(row > 68) Then                     
                  column = column + 2
                  row = 1
                  Call designbuild(excel,xlsheet,row,column,69,0)
               End If
               .Cells(row,column).Select
               Excel.Selection.Font.Bold = True
               .Cells(row,column).Value = doc.txtAbt(0)
               row = row + 1
               Call designbuild(excel,xlsheet,row-1,column,row-1,0)
            End If
            While (abt = doc.txtAbt(0))                           
               If (doc.nmbTel(0) <> "") And (doc.nmbTel(0) <> "0") And (doc.nmbTel(0) <> "n.v.") Then
                  countFIRMA = countFIRMA + 1
                  countAbt = countAbt + 1
                  If doc.txtArbeit(0) <> "" Then
                     .Cells(row,column).Value = "("&doc.txtArbeit(0)&") "&doc.txtNachname(0)&" "&doc.txtVorname(0)
                  Else
                     .Cells(row,column).Value = doc.txtNachname(0)&" "&doc.txtVorname(0)
                  End If
                  .Cells(row,column+1).Value = doc.nmbTel(0)
                  row = row +1   
                  If row > 69 Then                        
                     row = 1
                     column = column + 2
                     Call designbuild(excel,xlsheet,row,column,69,0)
                  End If
               Else
                  If countAbt = 0 And doc.txtAbt(0) <> "allgemein" Then
                     row = row - 1
                     .Cells(row,column).Value = ""
                     .Cells(row,column).Select
                     Excel.Selection.Font.Bold = False      
                     Excel.Selection.Font.Size = 8
                     nvStatus = 1
                  End If
                  If countFIRMA = 0 Then
                     If doc.txtFirma(0) <> "FIRMA Hauptsitz" Then
                        i = 3
                     Else
                        i = 1
                     End If
                     For j = 1 To i
                        row = row - 1
                        .Cells(row,column).Value = ""
                        .Cells(row,column).Select
                        Excel.Selection.Font.Bold = False      
                        Excel.Selection.Font.Size = 8
                        With Excel.Selection.Interior
                           .ColorIndex = 0
                        End With   
                        Const xlEdgeBottom = 9
                        Excel.Selection.Borders(xlEdgeBottom).LineStyle = xlNone
                        .Cells(row,column+1).Select
                        With Excel.Selection.Interior
                           .ColorIndex = 0
                        End With
                        Excel.Selection.Borders(xlEdgeBottom).LineStyle = xlNone
                     Next
                     nvStatus = 2
                  End If
               End If   
               Set entry = collection.GetNextEntry(entry)   
               If (entry Is Nothing) Then
                  abt = ""
                  firma = ""
               Else
                  Set doc = entry.Document
                  If nvStatus = 1 Then
                     abt = ""
                  End If
                  If nvStatus = 2 Then
                     abt = ""
                     firma = ""
                  End If
               End If   
               If (doc.txtFirma(0) <> firma) Then
                  If (row > 66) And Not (entry Is Nothing) Then                                             
                     column = column + 2
                     row = 1
                     Call designbuild(excel,xlsheet,1,column,69,0)
                  End If               
                  abt = ""
               End If      
            Wend            
         Wend
      End With   
   Wend
'*******************************************************************************************************   
   Call designbuild(excel,xlsheet,row,column,69,"abschluss")      
'*******************************************************************************************************
'Excel-Verbindung trennen
'*******************************************************************************************************
   Print "Verbindung zu Excel wird getrennt..."
   xlWorkbook.Close True
   Excel.Quit '// Close Excel
   Set Excel = Nothing 'den Speicher leeren
   Print " " 'Statuszeile löschen   
'*******************************************************************************************************
End Sub


schau es einfach mal durch, falls du noch fragen hast gerne...
funktioniert auf jeden fall zu 100%!

HeiCore:
Fehlt da noch eine ScriptLibrary?

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln