Reputation: 1022
I'm trying to allow users to dynamically link to the current version of a document from within a rich-text other, unchanged documents in a suite of operations manual databases. Each document has a key value (UID in this case) that is on all versions of the document. The most recent approved version should be opened when the user clicks on the link, even though the document they're reading hasn't been updated.
I've got a button which lets them select to which database they want to link and then select to which document. It then builds the appropriate formula language and drops it into the rich-text field. Then, the user copy-pastes it into a hot spot link and it will allow readers to click and open the document that's linked.
This works fine when all documents are in the same database, but it's failing to get the UNID to open the destination document in Notes. In a browser client, I can just use a view name and the value in the first column.
When I put this code in the hotspot link, it never returns the UNID or seems to think it's not text. The column formula in the view is @Text(@DocumentUniqueID)....
UID := "9C0051CB5F";
database := "qualityAndCompliancedb";
server := @Name ( [CN]; @Subset ( @DbName; 1 ));
filepath := @Text ( @DbLookup ( "Notes":"NoCache"; ""; "(LUDbConnections)"; database; "dbPath" ) );
filepath := @ReplaceSubstring ( filepath; "\\"; "/" );
rawReplicaID := @Text ( @DbLookup ( "Notes":"NoCache"; ""; "(LUDbConnections)"; database; "dbRepID" ) );
UNID := @DbLookup ( "Notes":"NoCache"; server : filepath; "UIDLU"; UID; 3 );
@If ( @IsError ( UNID ); "Bad UNID"; @ClientType = "Web"; "/" + filePath + "/UIDLU/" + UID;
"Notes:///" + rawReplicaID + "/0/" + UNID );
Nonetheless, when I put that code into computed text in the rich text field, and add the following to display values, I see all the values when I have the document in edit mode. I see nothing when in read mode, which is also puzzling.
"UID: " + UID + @NewLine +
"database " + database + @NewLine +
"server " + server + @NewLine +
"filepath " + filepath + @NewLine +
"rawReplicaID " + rawReplicaID + @NewLine +
"UNID " + UNID + @NewLine +
"Notes:///" + rawReplicaID + "/0/" + UNID
Like I say, when that DbLookup is within the same database, I have no problem with the hot spot link. If the computed text was failing to return a value, I would think it was a bad lookup or something with database configuration or access, but it doesn't fail.
What am I doing wrong?
Upvotes: 2
Views: 161
Reputation: 1022
I decided to do away with the lookup for the database. It's replica ID and filepath won't change, so I have it determine those when it creates the formula language.
Since I don't remember formula language as well as I ought to, I was surprised to find out that the work-around to have the document unique ID converted to text within a column isn't really necessary.
@DbLookup( class : cache ; server : database ; view ; key ; columnNumber ; keywords )
The keywords include [RETURNDOCUMENTUNIQUEID] as one option. Using that instead of a column value returns a valid unique ID when using this DbLookup.
Upvotes: 1