Display Attachments Where You Want

Don't you hate when you have attachments on the Web and you have to scroll down to the bottom of the rich text

field to get them. With this solution, you can put your attachments in a different field on the form, add an icon to the left of it and make it a live link so that you can either click on the attachment icon at the bottom or the link that is displayed. You can even do more tests on the attachment type to display different icons. Enjoy.

Put the following code into a "computed for display" text field.


sView := "WebAllMessages";
@If(@Attachments = 0; @Return(""); "");
sDoc := @Text(@DocumentUniqueID);
sBaseURL := "/" + @ReplaceSubstring(@Subset(@DbName; -1); "\"; "/") + "/" + sView + "/" + sDoc + "/$FILE/";
sImg := "[<img border="0" height="17" width="19" src="/icons/afolder.gif" align=bottom alt="">]";
lsAttFiles1 := @ReplaceSubstring(@AttachmentNames; "%"; "%25");
lsFrom := " " : ";" : "/" : "?" : ":" : "@" : "=" : "&" : "<" : ">" : """ :
"#" : "{" : "}" : "|" : "\" : "^" : "~" : "[" : "]" : "`";
lsTo := "%20" : "%3B" : "%2F" : "%3F" : "%3A" : "%40" : "%3D" : "%26" : "%3C" : "%3E" : "%22" : "%23" : "%7B" : "%7D" : "%7C" : "%5C" : "%5E" : "%7E" : "%5B" : "%5D" : "%60";
lsAttFiles := @ReplaceSubstring(lsAttFiles1; lsFrom; lsTo);
lsLens := (" (" + @Text(@Integer(@AttachmentLengths / 1024); ",")) + "k)";
lsAttNames := @AttachmentNames;
lsAttURLs := (sBaseURL + lsAttFiles) + "?OpenElement";
lsPrefix := ("[<a href="" + lsAttURLs) + "">]" + sImg + " ";
lsRefs := (lsPrefix + lsAttNames) + "[</a>]";
@Implode(lsRefs + lsLens; "[
]")

This was first published in November 2000

Dig deeper on Domino Resources - Part 3

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:

SearchWinIT

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

SearchVirtualDataCentre.co.UK

Close