#oldschool @formula to check for attachments

I have started at a new company¬†and they didn’t have an XIC (XPages Information Center) so my XPages Knowledge db needed to be installed (a regular Notes db for quickly copying & pasting rich text, snippets, storing sample applications, multiple media files).

The database is a couple of years old so it needed some updates. One was to hide a “files section” from printing in case there are no files attached. I noticed embedded images start with an “ST” naming in the @attachments array (correct me if I am wrong).

Finally I came up with the following rule for a computed sub form:

files:=@AttachmentNames;
counter:=0;
REM{“check if files contains a point. embedded images do not contain them”};
@For(n := 1;n <= @Elements(files); n := n+1;
@If(
@Contains(files[n];”.”);
counter:=counter+1;
“”)
);
@If(@IsNewDoc;”Attachments”;counter!=0;”Attachments”;””)