Moving attachments on a Web form

This is a Domino solution for hiding the attachments at the bottom of a Web form, and placing them at a designated spot elsewhere in the form.

View member feedback to this tip.

This is a Domino solution for hiding the attachments at the bottom of a Web form, and placing them at a designated spot elsewhere in the form. It uses icons that represent the program used to create/read them in.

Instructions:

  1. Add a hidden field on the top of your form. Fields:

    Name: $V2AttachmentOptions
    Type: Text computed for display
    Value: 0

  2. Place another field in your form that is hidden when read:

    Name: MiscBody (doesn't matter)
    Type: Rich Text, editable
    Web Access Display: Using Java Applet
    Default Value: None

  3. Hide paragraph when document is previewed/opened for reading

  4. You will need the images you wish to use to represent the attachments. Place them in your resources image folder. The ones I am using for this example are:

    Word_Icon.gif
    Excel_icon.gif
    Generic_icon.gif
    Pdf_icon.gif
    Powerpoint_icon.gif
    Text_icon.gif

  5. On your form, where you want the attachments with their icons to appear, place a computed text field.

  6. In that field, place the code you see below.

  7. Substitute the NSF file name with your database's name, and server name, if necessary.

This handles up to five attachments. You will have to add more code if you think they will be adding more attachments to one form.

Code:

temp:=@Implode(@AttachmentNames;";");
at1 := @If(@Attachments >= 1;
@Word(temp;";";1);"");
Att1 := @If(@Attachments >= 1;
@Right(@Word(temp;";";1);3);"");
icon1:=@If(@UpperCase(Att1) = "PDF";"
<IMG 
SRC=/ProjectTracking.NSF/pdf_icon.gif
?OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att1) = "XLS";"
<IMG SRC=/BusiRpt.NSF/excel_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att1) = "DOC";"
<IMG SRC=/ProjectTracking.NSF/Word_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att1) = "PPT";"<IMG 
SRC=/ProjectTracking.NSF/powerpoint_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att1) = 
("TXT" : "HTM" : "HTML");"<IMG 
SRC=/ProjectTracking.NSF/text_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(Att1 != "";"<IMG SRC=/ProjectTracking.
NSF/generic_icon.gif?
OpenImageResource BORDER=0 >" ; ""))))));
Final1 := "<a href=""+ @Text
(@DocumentUniqueID)+"/$file/"+at1+"" 
target="_new">" + icon1 + "   " + at1 +
 "</a> <br>";

at2 := @If(@Attachments >= 2;
@Word(temp;";";2);"");
Att2 := @If(@Attachments >= 2;
@Right(@Word(temp;";";2);3);"");
icon2:=@If(@UpperCase(Att2) = 
"PDF";"<IMG 
SRC=/ProjectTracking.NSF/pdf_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att2) = "XLS";"
<IMG SRC=/ProjectTracking.NSF/excel_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att2) = "DOC";"
<IMG SRC=/ProjectTracking.NSF/Word_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att2) = "PPT";"<IMG 
SRC=/ProjectTracking.NSF/powerpoint_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att2) = ("TXT" : "HTM" 
: "HTML");"<IMG 
SRC=/ProjectTracking.NSF/text_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(Att2 != "";"<IMG SRC=/ProjectTracking.
NSF/generic_icon.gif?
OpenImageResource BORDER=0 >" ; ""))))));
Final2 := "<a href=""+ 
@Text(@DocumentUniqueID)+"/$file/"+at2+"" 
target="_new">" + icon2 + "   " +
 at2 + "</a> <br>";

at3 := @If(@Attachments >= 3;
@Word(temp;";";3);"");
Att3 := @If(@Attachments >= 3;
@Right(@Word(temp;";";3);3);"");
icon3:=@If(@UpperCase(Att3) = 
"PDF";"<IMG 
SRC=/ProjectTracking.NSF/pdf_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att3) = "XLS";"
<IMG SRC=/ProjectTracking.NSF/excel_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att3) = "DOC";"
<IMG SRC=/ProjectTracking.NSF/Word_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att3) = "PPT";"<IMG 
SRC=/ProjectTracking.NSF/powerpoint_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att3) = ("TXT" : "HTM" : 
"HTML");"<IMG 
SRC=/ProjectTracking.NSF/text_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(Att3 != "";"<IMG SRC=/ProjectTracking.NSF/
generic_icon.gif?
OpenImageResource BORDER=0 >" ; ""))))));
Final3 := "<a href=""+ 
@Text(@DocumentUniqueID)+"/$file/"+at3+"" 
target="_new">" + icon3 + "   " + at3 
+ "</a> <br>";

at4 := @If(@Attachments >= 4;
@Word(temp;";";4);"");
Att4 := @If(@Attachments >= 4;
@Right(@Word(temp;";";4);3);"");
icon4:=@If(@UpperCase(Att4) = 
"PDF";"<IMG 
SRC=/ProjectTracking.NSF/pdf_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att4) = "XLS";"
<IMG SRC=/ProjectTracking.NSF/excel_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att4) = "DOC";"
<IMG SRC=/ProjectTracking.NSF/Word_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att4) = "PPT";"<IMG 
SRC=/ProjectTracking.NSF/powerpoint_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att4) = ("TXT" : "HTM" : 
"HTML");"<IMG 
SRC=/ProjectTracking.NSF/text_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(Att4 != "";"<IMG SRC=/ProjectTracking.NSF/
generic_icon.gif?
OpenImageResource BORDER=0 >" ; ""))))));
Final4 := "<a href=""+ @Text
(@DocumentUniqueID)+"/$file/"+at4+"" 
target="_new">" + icon4 + "   " +

at5 + "</a> <br>";
at5 := @If(@Attachments >= 5;
@Word(temp;";";5);"");
Att5 := @If(@Attachments >= 5;
@Right(@Word(temp;";";5);3);"");
icon5:=@If(@UpperCase(Att5) =
 "PDF";"<IMG 
SRC=/ProjectTracking.NSF/pdf_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att5) = "XLS";
"<IMG SRC=/ProjectTracking.NSF/excel_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att5) = "DOC";"
<IMG SRC=/ProjectTracking.NSF/Word_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att5) = "PPT";"<IMG 
SRC=/ProjectTracking.NSF/powerpoint_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(@UpperCase(Att5) = ("TXT" : "HTM" : 
"HTML");"<IMG 
SRC=/ProjectTracking.NSF/text_icon.gif?
OpenImageResource BORDER=0 >" ;
@If(Att5 != "";"<IMG SRC=/ProjectTracking.NSF/
generic_icon.gif?
OpenImageResource BORDER=0 >" ; ""))))));
Final5 := "<a href=""+ @Text
(@DocumentUniqueID)+"/$file/"+at5+"" 
target="_new">" + icon5 + "   " + 
at5 + "</a> <br>";

final := final1+ final2+ final3+ final4+ final5; final

MEMBER FEEDBACK TO THIS TIP

The above code can be significantly simplified to:

imgOpen := "<img src="";
imgLoc := "/projecttracking.nsf/";
imgClose := ".gif" border="0">";
thisUnid := @text(@documentuniqueid);
anchorOpen := "<a href="";
anchorMiddle := "" target="_new">";
anchorClose := "</a>";
anchorOpen + thisUnid + "/$file/" + 
@attachmentnames + anchorMiddle + imgOpen + 
imgLoc + @lowercase(@right(@attachmentnames;"."))
 + imgClose + anchorclose;

This will work without having to repeat the code regardless of the number of attachments. The only requirement is for an icon to be associated with each extension in the resource library (or wherever you want for that matter, just change the imgLoc variable).

—Ben J.

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Joanne K. Lanese Jarvis. 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.

This was first published in September 2004

Dig deeper on Lotus Notes Domino Formula Language

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close