I’m trying to create a view with a selection formula that only displays documents that contain doclinks.
I can see within the individual document properties that the link id is stored in $Links, but I cannot figure out how to look for them programmatically.
Subject: Select doclinks in view selection formula
I can see within the individual document properties that the link id is stored in $Links, but I cannot figure out how to look for them programmatically.
For your view selection purposes, you don’t need to. Just create your SELECT statement based on the presence of the $Links field.
Subject: Not going to work that way - here’s more info
First of all, only summary fields are available in a view, and $Links isn’t a summary field. Second of all, the presence of $Links does not guarantee doclinks, and the absence of $Links certainly doesn’t ensure the lack of them. (See my Rich Text 101 - Doclinks for a bit more info on doclinks).
Short answer: You can’t have a view that does this directly.
Longer answer: You could either have a field that gets populated when a document is saved, or an agent that populates a folder (or sets a field). That would leave you with either a field indicating the presence of doclinks or a folder containing the documents with doclinks. Either type of agent would need to use the NotesRichText clases to find the doclinks.
Subject: RE: Not going to work that way - here’s more info
Doh! Cheers Ben, I was forgetting myself.
Mary, another idea is this, and it’s only workable if you create doclinks programmatically (i.e. via a controlled process in your application and not as ad hoc rich text content), but it’s worked for me recently.
Our application has some code in it to add doclinks in a specific field. In addition to writing the actual doclink, the code writes the linked document’s UNID to a hidden multi-value field in the original document. The reason for this is two-fold:
We can easily check linked data is still “valid” (the database has a lot of changing / deleted content) via a nightly agent (e.g. check all the UNIDs are still there, and if not, remove relevant UNID / doclink)
As a corollary to this, we can easily show documents which have doclinks in them in a “links” view