---
title: 202409 のの会@関数Talk 59th | Talks around @Functions in Notes and Domino
tags:  #domino #notes #dominoforever #lotus notes #のの会 #@関数 #@attachmentlengths #@sum #@attachments  
author: [あう゛](https://www.docswell.com/user/abesat)
site: [Docswell](https://www.docswell.com/)
thumbnail: https://bcdn.docswell.com/page/8JDX6W3K7G.jpg?width=480
description: Notes Dominoの@関数を取り上げながら、調べたこと、経験したことを雑談してゆきます。  第59回は @AttachmentLengthsの続きから、@Sum、@Attachments について
published: January 30, 26
canonical: https://www.docswell.com/s/abesat/ZM6JXE-202409-function-talk-59th
---
# Page. 1

![Page Image](https://bcdn.docswell.com/page/8JDX6W3K7G.jpg)

@
-notes knows community- 2024/09/12
@関数Talk
第59回
公開版
@
Talks around @Functions in Notes and Domino
✔ @AttachmentLengths
59th
✔ @Sum
✔ @Attachments
阿部 覚
(X:) @abesat


# Page. 2

![Page Image](https://bcdn.docswell.com/page/VEPPY943E8.jpg)

@
@AttachmentLengths
で放談
@


# Page. 3

![Page Image](https://bcdn.docswell.com/page/27V2GMXN7Q.jpg)

@AttachmentLengths
@
添付のサイズを返してくれる @AttachmentLengths のつづき
ですが、今回はまず、
ビューに文書ごとの添付サイズの合計を表示してみます
おさらいですが、合計でなくてよいなら
単に @AttachmentLengths を式で設定
デザイナーから見てこんな感じですね
では、これを合計するとして
合計するためには
@


# Page. 4

![Page Image](https://bcdn.docswell.com/page/5JGR8GV57L.jpg)

@
@Sum
@
を、ちょっと放談


# Page. 5

![Page Image](https://bcdn.docswell.com/page/47QV9X6LEP.jpg)

@
@Sum
ヘルプによれば
「一連の数値または数値リストを加算します。」
すこし硬い書き方ですね、要するに合計してくれます
@


# Page. 6

![Page Image](https://bcdn.docswell.com/page/KE4MX64571.jpg)

@Sum
@
使い方としては、
引数内に数値または数値リストを入れるもの
今回、引数内に入れたいのは @AttachmentLengths なので、
こんな感じで合計が出るわけですね
@
でも、よく見ると…


# Page. 7

![Page Image](https://bcdn.docswell.com/page/L718NV42JG.jpg)

@Sum / @AttachmentLengths
@
行によってはエラーがあります
@
添付がない文書の場合、@AttachmentLengths が返すのは
0ではなくヌル値(&quot;&quot;)です
ヌルは数じゃないから合計できないので、
エラーになってしまう次第


# Page. 8

![Page Image](https://bcdn.docswell.com/page/G7WZ4LX272.jpg)

@Sum / @AttachmentLengths
@
対策として、こういうふうに条件をつければ
エラーを防げます
@AttachmentLengths がヌル値(&quot;&quot;)でない時だけ合計
確かにこれでも大丈夫そう
もうちょっと、汎用的な方法として…
@


# Page. 9

![Page Image](https://bcdn.docswell.com/page/4JZ12M64E3.jpg)

@
@Attachments
で放談
@


# Page. 10

![Page Image](https://bcdn.docswell.com/page/YE6LVN2G7V.jpg)

@
@Attachments
ヘルプによれば
「文書に添付されているファイルの数を返します。」
@


# Page. 11

![Page Image](https://bcdn.docswell.com/page/GE51D52XJ4.jpg)

@Attachments
@
@Attachments もシンプルファンクションと連動しており
「添付ファイル」が
式としての @Attachments になります
@


# Page. 12

![Page Image](https://bcdn.docswell.com/page/97218N4QER.jpg)

@Sum / @AttachmentLengths / @Attachments
@
@
@Attachments を使ったこちらのやり方の方が
式も若干短く済みます


# Page. 13

![Page Image](https://bcdn.docswell.com/page/DJYZ6PMYEM.jpg)

@Sum / @AttachmentLengths / @Attachments
@
この記法、ようは True(1) か False(0) かを尋ねてるわけです
そして、1だけじゃなく
2以上の数も True として扱ってくれるので
添付ファイル数を表す@Attachmentsが
有無の判断に使えている次第です
@


# Page. 14

![Page Image](https://bcdn.docswell.com/page/V7N3Z5WR78.jpg)

@Sum / @AttachmentLengths / @Attachments
@
なお、
@AttachmentLengths のヘルプにはこんな例があります
次の例では、まず添付ファイルがあることを確認してから
添付ファイルの長さが合計されます。
@Sum(@Attachments &gt; 0; @AttachmentLengths; 0)
やってみましたが
…
だめじゃん
😭
@


# Page. 15

![Page Image](https://bcdn.docswell.com/page/YJ99ZYXZJ3.jpg)

@AttachmentLengths / @DocLength
@
@
こんどは添付サイズ合計の列の隣に、
文書サイズの@DocLength の列を置きました
が、こうして並べて比較するのはあまり意味がなさそう…
これまで確認したように、
@AttachmentLengths と @DocLength には
それぞれの値の出し方の違い、あいまいさの違いがあり


# Page. 16

![Page Image](https://bcdn.docswell.com/page/GJ89169YED.jpg)

@AttachmentLengths / @DocLength
@
@
左右を引き算した結果が
「文書の添付以外の部分のサイズ」というわけでもなく…
💦
今回の検証では無かったけど 、
@DocLength の方が
値が小さく表示される文書に出会うこともありますので


# Page. 17

![Page Image](https://bcdn.docswell.com/page/LJLWQ9W97R.jpg)

@Attachments
@
こんどは @Attachments をもう少しチェックします
さっきは「添付があるかないか」の判断に使いましたが
戻り値は、文書内の添付ファイルの総数です
@


# Page. 18

![Page Image](https://bcdn.docswell.com/page/47M91Z9VJW.jpg)

@Attachments
@
あと、ご参考までに
「@Attachments といえば 5番」ですね
こんな式
書いたことある開発者の方、
いますよね
ヘルプでは
その式のある列の
列プロパティでは
「値をアイコン表示」を
選択しておく
@If(@Attachments;5;0)
で掲載、どちらでもよいと思います
@


# Page. 19

![Page Image](https://bcdn.docswell.com/page/P7RGL6GWJ9.jpg)

@Attachments
@
これで
添付ファイルのある文書には、
列アイコンのクリップマークが
記号として表示されるわけです
@


# Page. 20

![Page Image](https://bcdn.docswell.com/page/PJXXWMXVJX.jpg)

@Attachments
@
こちらは
列アイコンの一覧を
表示したビューですが
（デザインは新しい方ね）
5番が添付に多用される
クリップマークですね
@


# Page. 21

![Page Image](https://bcdn.docswell.com/page/3JKWVGW5JD.jpg)

@今回はここまでです
すでに次回の「のの会」が告知されていますが、
コチラに関して
@
結論：
続きます
♥


# Page. 22

![Page Image](https://bcdn.docswell.com/page/LE31MN1175.jpg)

@
今回もお付き合い
ありがとうございました
🙂
@


