Das Notes Forum

Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: MrMagoo am 26.05.03 - 10:08:02

Titel: Tochterdoc ID als Link im Parentdoc
Beitrag von: MrMagoo am 26.05.03 - 10:08:02
Hallo,

ich schreib aus einem Tochterdokument heraus die Dokument ID in das Mutterdokument, funktioniert prima. Wie bekomme ich es aber hin, das die Dokument ID des Tochterdokuments, die jetzt ja in einem Feld im Mutterdokument stehlt, als Link auf das Tochterdokument behandelt?

Danke
Titel: Re:Tochterdoc ID als Link im Parentdoc
Beitrag von: Performance am 26.05.03 - 10:28:37
z.B
plink ist ein computed rtf Feld - hier schreibst du den link rein

im Queryopen des Doks - wird bei jedem öffnen berechnet:
If doc.HasItem( "plink" ) Then   
   Call doc.RemoveItem( "plink" )
End If
      
Set rtitem = doc.CreateRichTextItem( "plink" )
Set docChild = ..... deine initialisierung
         
Call rtitem.AppendDocLink( docChild , " <-- der Link zur Tochter")
Call rtitem.AddNewLine( 1 )


cu

Titel: Re:Tochterdoc ID als Link im Parentdoc
Beitrag von: wflamme am 26.05.03 - 17:43:43
Hier noch ein Oldtimer aus meiner KB:

FILE:    Linking a Parent to a Response
UPDATED: June 1996
AUTHOR:  Eric Koeler
         mailto:ekoeler@panix.com
         http://www.panix.com/~ekoeler
NOTE:    Copyright (C) 1997 by Eric Koeler, this file is protected by the
         GNU General Public License
----------------------------------------------------------------------------

Since every response document contains a field called $ref with its parent's Doc ID in it, you can set up a hidden view of response documents (No Response Hierarchy) with @Text($ref) as the first sorted column's formula - we'll call this view (ResponseLookupView) and this first sorted column Key.  
We can use this $ref field as a common unique lookup key.  Create a computed text field in the response document, call it myID, with @DocumentUniqueID as the formula.  Now create a computed text or a computed for display field in the parent document, we'll call it respLink, with the following formula:

     @DbLookup("";"";"(ResponseLookupView)";
     @Text(@DocumentUniqueID);"myID")

This respLink field will yield a doclink to the response document.
Titel: Re:Tochterdoc ID als Link im Parentdoc
Beitrag von: MrMagoo am 27.05.03 - 09:44:23
Hallo,
die Formel von WFlamme geht, zeigt die ID allerdings als String und nicht als Link an??
Gruß
Titel: Re:Tochterdoc ID als Link im Parentdoc
Beitrag von: doliman am 27.05.03 - 10:29:35
Hi,

wer's braucht:

mit zwei Varianten:
1. mit der Ansicht vom Beitrag oben oder
2. mit set dc = doc.responses

Dim session As New NotesSession
   Dim db As NotesDatabase
   Dim view As NotesView
   Dim dc As notesdocumentcollection
   Dim doc As notesdocument
   Dim rtitem As NotesRichTextItem
   Dim docChild As notesdocument
   
   Set doc = source.document
   Set db = session.currentdatabase
   Set view = db.GetView( "(ResponseLookupView)" )
   
   If Not doc Is Nothing Then
      If doc.HasItem( "unbennant" ) Then  
         Call doc.RemoveItem( "unbennant" )
      End If
      
      Set rtitem = doc.CreateRichTextItem( "unbennant" )
      Set rtitem = New NotesRichTextItem( doc, "unbenannt" )
      
      Set dc = doc.responses
      
      'Set dc = view.getalldocumentsbykey(doc.universalid)
      Set docChild = dc.GetFirstDocument
      While Not ( docChild Is Nothing )
         Call rtitem.AppendDocLink( docChild, docChild.universalid)
         Call rtitem.AddNewLine( 1 )
         Set docChild = dc.GetNextDocument( docChild )
      Wend
      
   End If
Titel: Re:Tochterdoc ID als Link im Parentdoc
Beitrag von: wflamme am 27.05.03 - 11:11:49
Hallo,
die Formel von WFlamme geht, zeigt die ID allerdings als String und nicht als Link an??
Gruß

Laß den @Text doch mal weg... ich glaube, das ist lt. Designerhilfe der Trick. Sorry, manche Sachen merke ich mir einfach nicht... wenn man viel mit Klassen programmiert, versucht man ohnehin zu vermeiden, daß zuviel Code außerhalb der Klassen steht, weil der dann außer (zentraler) 'Kontrolle' ist...