I came up with this solution from a requirement of a contact management db I was working on. Every page on the site needed to have a list of the "agencies" and "contacts" with links to open the respective document.
To do this I created a pair of multi-line select boxes that, when clicked, re-directed to that document. They appear on every page and look like this (excuse the colours):
And here is a working example that will take you to a few sites you may have heard of. Don't forget to come back though ;-)
How did I do this? Well, the first thing I did was create a field, called "contacts", that will act as a holder for all the links. This is a computed for display field with the following formula:
DBPath := @ReplaceSubstring( @Subset( @DBName; -1); "\\"; "/");
col := @DbColumn("" ; ""; "luCOPICK"; 2);
html := @If(@IsError(col); ">error</option>"; col);
" size=\"4\" style=\"width:150px;\" onChange=\"document.location.href=this.options[this.selectedIndex].value\">"+@NewLine
+ @Implode("<option value=\"/"+ DBPath + html; "")
This alone does not produce the select box, as computed for display fields only produce plain text for the browser. We need to use a little trick, wrapping some Pass-Thru HTML around this field will turn it into a "real" field.
The reason to use a computed for display field is simple: We don't want to save these links with any documents! There needs to be a field as well; without it domino errors because it "cannot find item".
Next thing to do is create the view, called "luCOPICK", that will hold the documents we are linking to. Order it on the first column and place something like the contact name in there. Use the second column to return the HTML to the lookup formula above. The column formula is:
"/co/" + @Text(@DocumentUniqueID) + "?OpenDocument\">" + ContactName + "</option>"
This creates the option tag for each document that sits in the select element created already.
Assuming you use it the same way as me (on every page) it is a good idea to put this field and surrounding text in to a subform. This way it is easy to include on all forms and any changes get applied to all instances.
Note: This method is limited in the number of document that can be linked to by the limits of the return to the DBColumn formula and the storage capacity of the "contacts" field. If you have lost then you might want to consider limiting which appear in the links. Place a field on the form used that asks whether to put the document in the "Quick Link". All you need to do then is edit the selection formula of the "luCOPICK" view.
Copyright © 2000 - 2024 Jake Howlett of Rockall Design ltd. This article was printed from codestore.net