About This Code
Brief Description:
compute link to attachment, including size, last modified, and file type
Notes Version:
R6.x, R8.x, R5.x, R7.x
Last Modified:
13 Apr 2009
OpenNTF Disclaimer
All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.
Code / Description
This formula computes a link using a standard format; it assumes one attachment per document.
attName:="MS Word document":"MS PowerPoint presentation":"Acrobat (pdf) document":"MS Excel spreadsheet";
attType:=".doc":".ppt":".pdf":".xls";
"<a class=\"download-link\" href=\""+cpAttURL+"\">"+cpAttachmentLabel+"</a> <span class=\"gray-dark\"><small>("+@Text(@Round(@AttachmentLengths/1000))+"KB, "+
@If(@Member(@Right(@AttachmentNames;4);attType)=0;"document"; attName[@Member(@Right(@AttachmentNames;4);attType)])+
", "+@Do(
dt := @AttachmentModifiedTimes;
day := @Right("0"+@Text(@Day(dt));2);
month := @Select(@Month(dt);"Jan";"Feb";"Mar";"Apr";"May";"Jun";"Jul";"Aug";"Sep";"Oct";"Nov";"Dec");
day + " " + month + " " + @Text(@Year(dt))
)+")</small></span>"
Usage / Example