Domino 9 und frühere Versionen > Entwicklung

Problem bei export ins txt

(1/3) > >>

LisaS:
Hallo,
ich wieder...

Also ich hatte vor geraumer Zeit hier mein Problem mit dem 64k Limit geschildert. Jetzt habe ich vermutlich die Lösung meines Problems gefunden, aber noch ein Paar Probleme bei den ich Eure Hilfe benötige.
Noch mal kurz erklärt worum es geht:
Es geht um ein Dukument in dem Qualifikationen der Mitarbeiter über eine Eingabemaske gespeichert werden.
Früher gab es ein Problem mit den Projektbeschreibungen, die unter umständen sehr viel Text enthalten und so schnell die 64k Grenze erreicht ist.
In meiner jetzigen Lösung schreibe ich die Daten in ein txt und hänge dieses in ein RT-Feld. Dieses txt läßt sich dann auch gut zum exportieren nach Word benutzen. Der Nachteil dieser Lösung ist daß, das Dokument immer gespeichert und geschlossen werden muß bevor ich den nächsten Datensatz erfassen kann.
Und da liegt auch schon mein erstes Problem:
Wie schaffe ich es das am Ende des Scriptes sich das uidok schließt und sich dann wieder öffnet?
Es öffnet sich zwar ein neues Fenster aber das alte schließt sich einfach nicht.
Vieleicht endeckt Ihr ja auch noch andere Formfehler, oder habt eine elegantere Lösung - ich bin ja noch am lernen ;D.
Hier das Script(Button im Dok.):

Sub Click(Source As Button)
   
   Dim workspace As New NotesUIWorkspace
   Set uidoc = workspace.CurrentDocument
   Set doc = uidoc.document
   
   WorkDir="c:\"
   fileName = "projekte1.txt"
   fileName2 = "projekte2.txt"
   
   ColData
   ColCheck
   Set rtitem = doc.GetFirstItem( "ObjCont" )
   If (rtitem.Type = RICHTEXT ) Then
     
  ' check for attachment in ObjCont item
      Set object = rtitem.GetEmbeddedObject( filename)
      If ( object Is Nothing ) Then
         NewCont
         MaskInit
         dspMask
         Attach
      Else
         Detach
         del
         AppendCont
         MaskInit
         dspMask
         Attach
      End If
      Call workspace.EditDocument( True , doc )
   End If
End Sub
----------------------------------------------------------------------
Sub ColData
   Dim workspace As New NotesUIWorkspace
   
   Set uidoc = workspace.CurrentDocument
   
     'Werte aus der Eingabemaske übernehmen
   start=uidoc.fieldgettext("Datum_Start")
   ende=uidoc.fieldgettext("Datum_Ende")
   kunde=uidoc.fieldgettext("BezeichnungKunde")
   branche=uidoc.fieldgettext("BezeichnungBranche")
   prjf=uidoc.fieldgettext("ProjektFunktion")
   prjt=uidoc.fieldgettext("ProjektTask")
   titel="Von|Bis|Kunde|Branche|Tätigkeit|Projektbeschreibung$"
End Sub
-----------------------------------------------------------------------------------
Sub ColCheck
            'Inhalte Prüfen
   If start="" Then
      start="..."
   End If
   If ende="" Then
      ende="..."
   End If
   If kunde="" Then
      kunde="..."
   End If
   If branche="" Then
      branche="..."
   End If
   If prjf="" Then
      prjf="..."
   End If
   If prjt="" Then
      prjt="..."
   End If
End Sub
------------------------------------------------------------
Sub NewCont
   writestr=start+"|"+ende+"|"+kunde+"|"+branche+"|"+prjf+"|"+prjt+"$"
   fileNum% = Freefile()
   Open WorkDir+fileName For Output As fileNum%
   Print #fileNum% ,writestr
   Close fileNum%
   Open WorkDir+fileName2 For Output As fileNum%
   Write #fileNum% ,start,ende,kunde,branche,prjf,prjt
   Close fileNum%
End Sub
------------------------------------------------------------------
Sub AppendCont
   writestr=start+"|"+ende+"|"+kunde+"|"+branche+"|"+prjf+"|"+prjt+"$"
   fileNum% = Freefile()
   Open WorkDir+filename For Append As fileNum%
   Print #fileNum% ,writestr
   Close fileNum%
   Open WorkDir+filename2 For Append As fileNum%
   Write #fileNum% ,start,ende,kunde,branche,prjf,prjt
   Close fileNum%
End Sub
-.-----------------------------------------------------------------
Sub MaskInit
   'Eingabemaske initialisieren  
   Dim workspace As New NotesUIWorkspace
   Set uidoc = workspace.CurrentDocument
   Call uidoc.fieldsettext("Datum_Start","")
   Call uidoc.fieldsettext("Datum_Ende","")
   Call uidoc.fieldsettext("BezeichnungKunde","")
   Call uidoc.fieldsettext("BezeichnungBranche","")
   Call uidoc.fieldsettext("ProjektFunktion","")
   Call uidoc.fieldsettext("ProjektTask","")
End Sub
--------------------------------------------------------------------
Sub Attach
   Dim workspace As New NotesUIWorkspace  
   Dim doc As NotesDocument
   Dim ni As Variant
   Dim no As Variant
   Dim no2 As Variant
   Dim cUNID As String
   
   Set uidoc = workspace.CurrentDocument
   Set doc = uidoc.document          
   
   Call uidoc.Save
   Call uidoc.Close
   InItem="ObjCont"
   Set ni = doc.GetFirstItem( InItem )
   Set no = ni.EmbedObject( EMBED_ATTACHMENT , "" ,  WorkDir & FileName )
   Set no2 = ni.EmbedObject( EMBED_ATTACHMENT , "" ,  WorkDir & FileName2 )
   Call doc.Save( True , False )
   doc.SaveOptions = "0"
   Call uidoc.Close  
End Sub
----------------------------------------------------------------------
Sub Detach
   Dim doc As NotesDocument
   Dim rtitem As Variant
   Dim fileCount As Integer
   Dim workspace As New NotesUIWorkspace
   Set uidoc = workspace.CurrentDocument
   Set doc = uidoc.document          
   Set rtitem = doc.GetFirstItem( "ObjCont" )
   If ( rtitem.Type = RICHTEXT ) Then
      Forall o In rtitem.EmbeddedObjects
         If ( o.Type = EMBED_ATTACHMENT ) Then
            fileCount = fileCount + 1
            wert=fileCount
            dest=WorkDir+"projekte"+wert+".txt"
            Call o.ExtractFile ( dest )
            Call doc.Save( True, True )
         End If
      End Forall
   End If
End Sub
----------------------------------------------------------------------

Sub del
   Dim workspace As New NotesUIWorkspace
   Set object = rtitem.GetEmbeddedObject( FileName )
   Call object.Remove
   Set object2 = rtitem.GetEmbeddedObject( FileName2 )
   Call object2.Remove
   Call doc.Save( True , False )
   doc.SaveOptions = "0"
   Call workspace.EditDocument( True , doc )
End Sub
--------------------------------------------------------------
Sub dspMask
   Dim uidoc As NotesUIDocument
   Dim workspace As New NotesUIWorkspace
   Dim dsp As dataRec
   
   Set uidoc = workspace.CurrentDocument
   Set doc = uidoc.document    
   'DSP-Felder initialisieren
   Call uidoc.FieldsetText("PR_1","")
   Call uidoc.FieldsetText("PR_2","")
   Call uidoc.FieldsetText("dspProjekte_3","")
   Call uidoc.FieldsetText("dspProjekte_4","")
   Call uidoc.FieldsetText("dspProjekte_5","")
   Open WorkDir+fileName2$ For Input As fileNum%
   While Not Eof(fileNum%) ' Read until end of file.
      Input #fileNum%, dsp.SDat, dsp.EDat, dsp.Firma, dsp.Branche, dsp.Funktion, dsp.Task
      
      Call uidoc.FieldAppendText("PR_1",dsp.SDat)
      Call uidoc.FieldAppendText("PR_1",";")
      Call uidoc.FieldAppendText("PR_2",dsp.EDat)
      Call uidoc.FieldAppendText("PR_2",";")
      Call uidoc.FieldAppendText("dspProjekte_3",dsp.Firma)
      Call uidoc.FieldAppendText("dspProjekte_3",";")
      Call uidoc.FieldAppendText("dspProjekte_4",dsp.Funktion)
      Call uidoc.FieldAppendText("dspProjekte_4",";")
      Call uidoc.FieldAppendText("dspProjekte_5",dsp.Task)
      Call uidoc.FieldAppendText("dspProjekte_5",";")
      Call doc.Save( True, True )
   Wend
End Sub
----------------------------------------------------------------------------


Ok, das wars ;)

Danke für Eure Hilfe
Hitcher

ata:
... wenn ich das auf die schnelle begriffen habe, dann benötigst du Eknorie's ReAttach...

... ansonsten habe ich auf meiner Homepage eine Funktion namens ReOpen - die öffnet das uidoc erneut - bei neuen Dokumenten eventuell noch die Form speichern...

ata

LisaS:
Hallo ata,

Dein ReOpen scheint der richtige Weg zu sein, ich weiß bloß nicht wie ich es in mein Script am besten einbinde.  Du hast ja als Notesdokument docthis das müßt doch bei mir doc sein oder?
ich hab das Script wie folgt abgeändert:
Jetzt bekomme ich Folgenden Fehler:
"Notes Error:Der angegebene Befehl ist vom Arbeitsplatz nicht verfügbar"

Function ReOpen(doc As NotesDocument) As Integer
   Dim ws As New NotesUIWorkspace
   Dim uidoc As NotesUIDocument
   Dim db As NotesDatabase
   Dim unid As String
   
   ReOpen = 0
   Set db = doc.ParentDatabase
   Call doc.Save(True , True)
   unid = doc.UniversalID
   doc.SaveOptions = "0" ' # ... Speicherabfrage vermeiden
   Set uidoc = ws.CurrentDocument
   Call uidoc.Close
   Set doc = db.GetDocumentByUNID(unid)
    Set uidoc = ws.EditDocument(True , doc) ' Hier kommt der Fehler
   Set doc = uidoc.Document
   If doc.HasItem("SaveOptions") Then  
            ' # ... das Feld SaveOptions wieder entfernen...
      doc.RemoveItem("SaveOptions")
      Call doc.Save( True , True )
   End If
   ReOpen = 1
   Print "Das Dokument wurde erneut geöffnet"
End Function

Ich führe die Funktion ReOpen Ganz am Ende meines Scripts durch.
Gib mir bitte ein Tip was ich noch tun könnte oder was ich falsch gemacht habe

Gruß
Hitcher

ata:
... bist du im Editmode?

ata

LisaS:
@ata:
....Ja

Hitcher

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln