Ever have a field that contains a large quantity of data that you want to include in a view? A good example are those fields that keep appending data, like audit trails and comments. It's a mess and requires excessive formatting. This technique breaks it up, displays a small piece of the text (perhaps most recent) and a clickable graphic that opens up the remainder of the text. This is a Web-only solution and was built for Internet Explorer browsers.
The first step is to add placeholders within the field that will later assist the breakup. I used an agent to modify existing documents and added code to the form for future documents. Add a character you know you will not see within the text (suggestions: @ or ^).
To display the view use a form with an embedded view. The column that contains your data should be structured as follows:
id := @Text(@DocumentUniqueID);
shortresult:=@If(@Contains
(holdPTComments;"@");@Left
(holdPTComments;"@");holdPTComments);
longresult := @ReplaceSubstring
(holdPTComments;"@";"<BR><BR>");
@If(@Contains(holdPTComments;"@");
"<td><span id="longid"+id+""
style="visibility:hidden;position:absolute">"
+longresult+"</span>
<span id="shortid"+id+""
style="visibility:hidden;position:absolute">"
+shortresult+"</span>
<span id="final"+id+""
style="visibility:visible">"+shortresult+
"</span> <br>
<span id="longgr"+id+""
style="visibility:visible;position:relative">
<IMG SRC="/icons/vwicn096.gif"
onClick=allComments
("long",document.forms[0],""+id+"")>
</span>
<span id="shortgr"+id+""
style="visibility:hidden;position:relative">
<IMG SRC="/icons/vwicn097.gif"
onClick=allComments
("short",document.forms[0],""+id+"")>
</span></td></tr>";
@If(holdPTComments!="";"<td>
<span id="final"+id+""
style="visibility:visible">"+shortresult+"
</span></td></tr>
";
"<td></td></tr>"))
holdPTComments is my lengthy text field.
I use the domino icons wicn096.gif (minus sign, collapse), and wicn097.gif
(plus sign, expand) to add some visual help.
The purpose of the If ... Then function is to isolate cases where there is no text, or one comment from the situations where there are more than one. Without more than more than comment there is no need to display the expand graphic.
This JavaScript function (allComments) expands and collapses the text in the column:
function allComments(choice,form,id){
var j;
if (choice=="short"){
idFrom = "shortid"+id;
idGrFrom = "shortgr"+id;
idGrTo = "longgr"+id;
}else{
idFrom = "longid"+id;
idGrFrom = "longgr"+id;
idGrTo = "shortgr"+id;
}
elFrom = document.getElementById
(idFrom);
idTo = "final"+id;
elTo = document.getElementById(idTo);
elTo.innerHTML = elFrom.innerHTML;
document.getElementById(idGrFrom).
style.visibility = 'hidden';
document.getElementById(idGrTo).
style.visibility = 'visible';
}
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip exchange by member Michael Torppey. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.