Ben Langhinrichs

Photograph of Ben Langhinrichs

E-mail address - Ben Langhinrichs







Recent posts

Wed 6 Jan 2021

REST plus RPC: the right data in the right format, and no more



Tue 5 Jan 2021

REST plus RPC: Do the demo backward



Tue 5 Jan 2021

Exciton Boost 4.6.0 and development assistance


January, 2021
SMTWTFS
     01 02
03 04 05 06 07 08 09
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31

Search the weblog





























Genii Weblog

Getting started with doclinks

Sun 24 Aug 2003, 10:32 PM



by Ben Langhinrichs
This "Getting started..." series of articles shows simple code snippets to demonstrate how to use common features of the Midas Rich Text LSX.  These are not meant to be full fledged samples, for which you could go to the Midas Samples page, but rather small bits of code to show how to get started.  These articles will also appear in the Reference section of the Midas Help db in somewhat altered form.


The Midas Rich Text LSX lets you find, create, manipulate and extract doclinks.  The most common tasks are accessing doclinks and retrieving their values, changing one or more component of all doclinks in a rich text field, and adding a new doclink.  Below are some quick code snippets to show these tasks.  Additional information can be found in the Midas Help db along with information about the individual properties and methods which relate to doclinks.

Accessing all doclinks and getting their values
Set rtchunk = rtitem.DefineChunk("Doclink 1")
If rtchunk.Exists Then
   Do
      Messagebox _
      "Replica ID: " & rtchunk.LinkReplicaID & Chr(10) & _
      "View UNID: " & rtchunk.LinkViewUniversalID & Chr(10) & _
      "Note UNID: " & rtchunk.LinkNoteUniversalID & Chr(10) & _
      "Popup text: " & rtchunk.LinkPopupText & Chr(10) & _
      "Hint server: " & rtchunk.LinkHintServer & Chr(10) & _
      "Anchor text: " & rtchunk.LinkAnchorText, _
      0, "Doclink Information for " & rtchunk.Definition
   Loop Until Not rtchunk.GetNextTarget
End If

Accessing all hyperlinks (link hotspots on text) and getting their values
Set rtchunk = rtitem.DefineChunk("Hyperlink 1")
If rtchunk.Exists Then
   Do
      Messagebox _
      "Link hotspot: " & rtchunk.Text & Chr(10) & _
      "Replica ID: " & rtchunk.LinkReplicaID & Chr(10) & _
      "View UNID: " & rtchunk.LinkViewUniversalID & Chr(10) & _
      "Note UNID: " & rtchunk.LinkNoteUniversalID & Chr(10) & _
      "Popup text: " & rtchunk.LinkPopupText & Chr(10) & _
      "Hint server: " & rtchunk.LinkHintServer & Chr(10) & _
      "Anchor text: " & rtchunk.LinkAnchorText, _
      0, "Hyperlink Information for " & rtchunk.Definition
   Loop Until Not rtchunk.GetNextTarget
End If

Changing one component of all doclinks (e.g., changing view unid to use All Documents view)
Set view = db.GetView("($All)")
Set rtchunk = rtitem.DefineChunk("Everything")
Call rtchunk.ChangeDoclinks("", view.UniversalID)

Changing one component of all doclinks that match a specific component (e.g., changing view unid to use All Documents view if the replica id is the current database)
Set view = db.GetView("($All)")
Set rtchunk = rtitem.DefineChunk("Everything")
Call rtchunk.ChangeDoclinks("", view.UniversalID, "", "", "", Ucase(db.ReplicaID))

Creating a new doclink using AppendLink
Set view = db.GetView("($All)")
Set rtchunk = rtitem.DefineChunk("Everything")
Call rtchunk.AppendLink("", db.ReplicaID, view.UniversalID, doc.UniversalID, "Follow link by clicking here...")

Creating a new hyperlink (link text hotspot) using AppendLink
Set view = db.GetView("($All)")
Set rtchunk = rtitem.DefineChunk("Everything")
Call rtchunk.AppendLink("My link", db.ReplicaID, view.UniversalID, doc.UniversalID, "Follow link by my link...")

Copyright 2003 Genii Software Ltd.

What has been said:

No documents found