#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:

REM{“check if files contains a point. embedded images do not contain them”};
@For(n := 1;n <= @Elements(files); n := n+1;

About these ads

Specialized in IBM Collaboration Services since 1997. Main focus is XPages and Connections development. Other interests: travelling, culture, skiing & cooking.

Tagged with: ,
Posted in @Formula
2 comments on “#oldschool @formula to check for attachments
  1. It is a little more complicated than that. Every OLE object will have an attachment called EXTnnnnnn, and then a series of attachments called STGnnnnn (not the same number), but older versions of Notes (maybe newer ones as well) may not have an extension if there is a duplicate file. If I attach a file called invoice.pdf, and then another called invoice.pdf, the second will usually be ATnnnnn. If I delete the original attachment, I am left with only ATnnnnn, which would not show the section according to your formula. That may seem unlikely, but if I have a document keep replacing the file to update with the latest, it can happen quite easily.

    It is also possible to have MIME parts as attachments, but those would have extensions.

  2. Dan Sickles says:

    This eliminates several opportunities for error in the for loop index management and counter increment::

    counter := @Sum(@Transform(@AttachmentNames; “fileName”; @if(@Contains(fileName; “.”); 1 ; 0 )))

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

I am Patrick Kwinten. I am a IBM Notes Domino Product Specialist since 1996. With this blog I am trying to give my contribution to the community.

The posts in this blog project my personal opinions, not the company I work for.

C U in Orlando


Follow my projects on OpenNTF. Below are some examples:

RSS Feed

Get every new post delivered to your Inbox.

Join 251 other followers

%d bloggers like this: