Das Notes Forum
Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: OCS am 06.11.03 - 13:17:26
-
versuche das schon die ganze zeit, aber wenn ich mit getitemvalue den inhalt des rtfeldes in ein von mir definiertes item kopieren will, bekomme ich type mismatch!
code ausschnitt:
Dim clipsupplink As notesitem
.
.
.
Set clipdoc = clipdc.GetFirstDocument
Set clipsupplink = clipdoc.getitemvalue("Link")
habe das dokument aus der collection im zugriff, kann auch diverse werte kopieren, nur diesen blöden dokLink nicht!
Kenn sich wer damit aus??
Gruß Björn
-
Du musst das mit GetItem holen, schliesslich ist Deine Variable ein Item-Objekt. GetItemValue gibt nur den Inhalt, nicht das Objekt selber zurück, und das passt ja dann nicht.
-
momente mal, Du willst doch einen DocLink kopieren? Geht so nicht, nur mit API Mitteln. Entweder das ganze RT Feld irgendwo andershin kopieren oder DocLink per API auslesen.
-
Möglich, die Frage ist etwas sehr unpräzise, da wird von RTItem gesprochen und die Daten deuten auf einen Link. OCS: Was willst Du erreichen?
-
cool, danke! habe damit die erste hürde genomme und bleibe dann doch wieder hängen!
ich versuche jetzt im nächsten schritt den inhalt des rt-feldes (den dokLink) in ein rt-feld von einem uidoc zu kopieren. dafür hole ich mir das uidoc ins backend :
1. Set backdoc=aktivuidoc.Document
2. Call backdoc.replaceitemvalue("Link", clipsupplink)
3. Call backdoc.save(True,True)
Jetzt bekomme ich allerdings an stelle 1. diesen fehler:
Notes error: Lettisch|0426|dic8.dic|itsplxlv.dll
was soll das???? kann ich vieleicht das item auch übers uidoc einfügen??
-
Entweder das ganze RT Feld irgendwo andershin kopieren
wie kann ich das ganze feld woanders hinkopieren?
-
notes help:
This script takes the Body item on document B and appends it to the end of the Body item on document A. The Body item on document B is deleted using the Remove method defined in NotesItem.
Dim docA As NotesDocument
Dim docB As NotesDocument
Dim rtitemA As Variant
Dim rtitemB As Variant
'...set values of docA and docB...
Set rtitemA = docA.GetFirstItem( "Body" )
Set rtitemB = docB.GetFirstItem( "Body" )
If ( rtitemA.Type = RICHTEXT And _
rtitemB.Type = RICHTEXT ) Then
Call rtitemA.AppendRTItem( rtitemB )
Call rtitemB.Remove
Call docA.Save( False, True )
Call docB.Save( False, True )
End If
oder
This script copies the Body and BriefDescription items from a document to a new mail memo in the current database. The Body item keeps its name; the BriefDescription item is renamed Subject.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim memo As NotesDocument
Dim itemA As NotesItem
Dim itemB As NotesItem
Set db = session.CurrentDatabase
'...set value of doc...
Set itemA = doc.GetFirstItem( "Body" )
Set itemB = doc.GetFirstItem( "BriefDescription" )
Set memo = New NotesDocument( db )
Call itemA.CopyItemToDocument( memo, "" )
Call itemB.CopyItemToDocument( memo, "Subject" )
Call memo.Send( False, "Cynthia Brainey" )
-
danke erstmal für Deinen Tip, aber jetzt fliege ich bei deinem vergleich mit object variable not set raus! könnte dran liegen, das der debugger an dieser stelle anzeigt, das beide variablen notesitems vom typ variant sind, obwohl das eigentlich rt-felder sind, oder?
habe mal den ganzen code drangehängt! nicht aufregen, ist nicht so ganz sauber, aber funktioniert bis auf diesen mist... ;D
Sub Initialize
Dim uidoc1 As notesuidocument
Dim backdoc As notesdocument
Dim ss As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim clipdb As NotesDatabase
Dim clipdc As NotesDocumentCollection
Dim clipdoc As NotesDocument
Dim mainDoc As NotesDocument
Dim mainDocID As String
Dim dboxtitle As String
Dim ok As Integer
Dim authorx() As String
Dim n As Long
Dim m As Long
Dim filePath As String
Const CLIPNAME = "\~clipbrd.ncf"
Set doc = ss.DocumentContext
Dim clipsupplink As notesitem
Dim rtitemA As Variant
Dim rtitemB As Variant
'Zwischenablage öffnen
filepath = ss.GetEnvironmentString( "Directory", True ) & CLIPNAME
Set clipdb = ss.GetDatabase( "", filepath )
If clipdb Is Nothing Then
Messagebox "Kein Dokument in Zwischenablage"
Exit Sub
End If
If Not clipdb.IsOpen Then
Messagebox "Kein Dokument in Zwischenablage"
Exit Sub
End If
Set clipdc = clipdb.AllDocuments
If clipdc.count = 0 Then
Messagebox "Kein Dokument in Zwischenablage"
Exit Sub
End If
Set db = ss.CurrentDatabase
Set clipdoc = clipdc.GetFirstDocument
' Set clipsupplink = clipdoc.GetFirstItem( "Link" )
Set rtitemA = clipdoc.GetFirstItem("Link")
'Variablen zum Schlüssel auslesen
Dim session As New NotesSession
Dim rtitem As notesrichtextitem
Dim item As notesitem
Dim db2 As NotesDatabase
Dim workspace As New NotesUIWorkspace
Dim uidoc As notesuidocument
Dim aktivuidoc As notesuidocument
Dim cpdoc As NotesDocument
Dim aufuposi As String
Dim uiview As NotesUIView
Dim aktivdocid As String
Dim kunde As String
Dim activdoc As notesdocument
Dim collection As notesdocumentcollection
Dim currentaktivuidoc As notesdocument
Dim currentdoc As notesdocument
Dim problem As String
Dim titel As String
Dim aktivdoc As notesdocument
Dim aunr As String
Dim posi As String
Dim temp As Variant
Dim adoc As Variant
Set db2 = session.CurrentDatabase
Set uiview = workspace.Currentview
Set collection = db2.UnprocessedDocuments
Set cpdoc = collection.GetFirstDocument()
Call uiview.SelectDocument(cpdoc) ' Soll das aktuell ausgewählte Dokument in den Zugriff nehmen
Set aktivuidoc = workspace.ComposeDocument("OCS02/OCS GmbH","aktiv\fridaakt.nsf","aktion")
Call aktivuidoc.fieldsettext("Zeitvon", "00:00")
Call aktivuidoc.fieldsettext("zeitbis","00:00")
Call aktivuidoc.fieldsettext("dauer","0")
Call aktivuidoc.fieldsettext("TKT", "055")
Call aktivuidoc.fieldsettext("JNF", "N")
Set backdoc=aktivuidoc.Document
Call backdoc.save(True,True)
Set rtitemb = backdoc.GetFirstItem("Link")
Call aktivuidoc.save
Dim id As String
If ( rtitemA.Type = RICHTEXT And _
rtitemB.Type = RICHTEXT ) Then
Call rtitemb.AppendRTItem( rtitema )
Call rtitema.Remove
Call backdoc.Save( False, True )
Call clipdoc.Save( False, True )
'aktivdocid = aktivuidoc.Document.universalid
Call aktivuidoc.refresh
Call aktivuidoc.save
End If
End Sub
-
an welcher genau kommt die Fehlermeldung?
-
zeile 11 von unten :-[
-
wo wird rtitemA gesetzt?
-
Das war ja nun sehr hilfreich ... 'n Sack voll Code, und wir dürfen jetzt Zeilen zählen. Nicht ganz fair, nicht ganz fein !
Ich tippe mal (wenn ich mich jetzt nicht verzählt habe), daß es entweder rtItemA oder rtItemB nicht gibt. Das die Dinger als Variant deklariert sind, ist sowieso murks, ist aber keine Fehlerursache.
Du solltest jetzt also mal ermitteln, ob es die items nun gibt oder nicht. Dazu bröselst Du Dir am besten die betreffende "11. Zeile von unten" so auseinander, daß beide items in separaten Statements per If abgefragt werden und grübelst dann darüber nach, warum es das eine oder andere nicht gibt.
By the way: Nach jedem (!) instantiiertem Object muss - wegen Ordnung und Sauberkeit im Schlachthof - ein
If xxx is nothing then ... Fehlerbehandlung stehen. Du wirst sonst nicht froh !
Bye & good luck,
Bernhard
-
@Rob den Grünen:
wo wird rtitemA gesetzt?
Zeile 41 ;D ;D ;D
-
sorry, wegen der 11. zeile von unten :-X , bin dankbar für jeden rat...wenn ich ritema als notesitem deklariere (anstatt als variant) , bekomme ich im debugger den doclink sogar angezeigt, aber dann kann ich leider kein "Call rtitemb.AppendRTItem( rtitema )" mehr machen! das regt mich so langsam auf...
-
Ich hoffe, Du regst Dich über Dich selber auf ;-)
Die vorgesehene Methode funktioniert ja, und in der DesignerHelp steht doch auch, welcher Stolperstein möglich ist:
notesRichTextItem2
The item to be appended. If you specify Nothing, this method will generate an error.
Ich befürchte, Du hast meine Antwort nur sehr oberflächlich gelesen und nutzt nicht den Debugger (incl. Kontrolle der jeweils aktuell verwendeten Variablen).
Bernhard