---
title: 202206 のの会@関数Talk 36th | Talks around @Functions in Notes and Domino
tags:  #lotus notes #hcl technologies #notes domino #domino designer #formula language #@関数 #式言語 #dominoforever #ずっとノーツ #hcl domino #hcl digital solutions #hcl notes #notes #domino #のの会 #notesknows #ローコード #low-code #@repeat #@return  
author: [あう゛](https://www.docswell.com/user/abesat)
site: [Docswell](https://www.docswell.com/)
thumbnail: https://bcdn.docswell.com/page/LJ35WWP275.jpg?width=480
description: Notes/Dominoの@関数を取り上げながら、調べたこと、経験したことを雑談してゆこうと思います。  第36回は @Repeat と @Return について
published: August 14, 23
canonical: https://www.docswell.com/s/abesat/KNR9EW-202206-function-talk-36th
---
# Page. 1

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

@
-notes knows community- 2022/06/09
@関数Talk
第36回
公開版
@
Talks around @Functions in Notes and Domino
36th
✔ @Repeat ✔ @Return
阿部 覚
(tw:) @abesat


# Page. 2

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

@
@Repeat
@
で放談


# Page. 3

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

@
前回、話の肴にしたのは@Unique
引数なしの使い方に話の重点を置いちゃいましたが
引数を指定するやり方で、
@Unique( textlist )
リスト内に複数あるものをひとつにまとめることに
使われます
@
対称的な、ひとつを複数にする関数はない？
と、浮かんだのが
今回ネタにする @Repeat ですが
@Repeatと真逆の働きをするってわけではありません


# Page. 4

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

@
使い方…たとえば、こんな感じ？
@


# Page. 5

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

@
@Unique の場合は リスト内の複数要素を単一化するけど
@


# Page. 6

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

@
@Repeat は、リストの要素が増えるわけではなく
単に文字列が連結したまま繰り返されます
@


# Page. 7

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

@
じゃあ、ちょっと話はそれるけど
リストを対象にして値を繰り返す関数はないの？
式で実現しようとする場合
単一の@関数としては、無さそうです
おそらく
@For などのループ型の関数を組み合わせて
値の追加を繰り返させる形になるのでは…
@


# Page. 8

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

@
ただ、繰り返す対象の文字列をリストで指定できるので、
こんなことはできちゃいます
@
まてよ…下のほうは、1文字足りないぞ💦


# Page. 9

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

@
そこで、繰り返す文字数の方も
リスト化したけど、効果ありませんでした😅
👆
結局7文字
@


# Page. 10

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

@
さて、ここまでご紹介した @Repeat はこんな形式
@Repeat( string ; number )
ひとつまたは複数の文字列を、●回繰り返して！
と指定するわけです
でも、
ヘルプにはもう一つ引数がついた形で掲載されています
@


# Page. 11

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

@
省略されることが多い、この3番目の引数のことを
@Repeat( string ; number ; numberchars )
個人的には、
打ち止め指定
@
と、名付けたく思います


# Page. 12

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

@
こんな感じです
@
繰り返しを、その区切りにはこだわらずに
指定の文字数でおしまいにしてしまいます


# Page. 13

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

@
なんに使えるかいまいちピンときませんが
例えばこんなことはできると思いました
ユーザー入力欄の下に
計算結果テキストで
文字数分の&quot;ルーラー&quot;もどきを
出してみる
入力欄も計算結果テキストも
同じサイズの固定長フォントに
そろえています
@
&quot;打ち止め指定&quot;の判断基準は
あくまで文字数である点に注意ください
日本語を扱う場合は
全角と半角が混じっていても、それぞれが1文字です


# Page. 14

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

@
では、@Repeat はここらで打ち止めにして
@


# Page. 15

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

@
@Return
@
で放談


# Page. 16

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

@
この関数の
ことを、
私は
ハイ それまでョ
関数
@
と、
称したく
思います😏


# Page. 17

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

@
ヘルプにはこう書かれています
「この関数は、ある条件が True の場合にのみ式の残りの部
分を実行するときに便利です。」
逆に言うと、式に残りの部分がないのに
@Return を使っても、あまり意味がありません
@
ヘルプに載っているサンプルを見てみましょう


# Page. 18

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

@
あれ…
@If(@Prompt([YesNo];&quot;Continue?&quot;;&quot;Do you want to continue reading your
mail?&quot;);@Command([NavNext]);@Return(&quot;&quot;))
@If(@Environment(OrderNumber)=&quot;&quot;;@SetEnvironment(&quot;OrderNumber&quot;;
&quot;0&quot;);@Return(@Environment(&quot;OrderNumber&quot;)))
lookup := @DbLookup(&quot;&quot; :&quot;&quot; ; &quot;serverName&quot; :&quot;fileDirectory\\
databaseName.nsf&quot;; &quot;People&quot; ; &quot;Jackie Brown&quot;; 3);
@If(@IsError(lookup); @Return(@Prompt([OK];&quot;Error&quot;;&quot;Error locating the
requested job title.Aborting lookup&quot;)); lookup)
@
だから、サンプルをそこでおわりにしちゃぁ
意味ないですってば～


# Page. 19

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

@
式言語って、複数の行にわたっている場合
@If(・・・・・・・・・・・・・・・・・・);
tmp1 := ・・・・・・・・・・・・・・;
@If(・・・・・・・;
@Prompt(・・・・・・・・・・・);
・・・・);
tmp2 := tmp1・・・・・・・・・・・・・・;
・・・・;
・・・・・;
tmp1+tmp2
@
何も明示されていなくても、
最後の部分に書かれている式の値を返す
というお約束がありますね


# Page. 20

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

@
でもどんな条件の場合もすべて最後の部分だけで
答えを返すように式を作るのはきびしい
@If(・・・・・・;・・・・;@Return(&quot;1&quot;));
tmp1 := ・・・・・・・・・・・・・・;
@If(・・・・・・・;
@Prompt(・・・・・・・・・・・);
・・・・);
tmp2 := tmp1・・・・・・・・・・・・・・;
・・・・;
・・・・・;
tmp1+tmp2
条件満たさない？
なら
ハイ、&quot;1&quot;返します
🎵それまでーョ
@
でもそんな時、@Return で一部の条件を逃がして
ここで値を返して終わり！にできます
これによって式全体も内容がすっきりし
短く誤りの置きづらい形にできるという
利点が生じます


# Page. 21

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

@
…と、基本を話したところで😅
@If(&quot;⏰お時間です&quot;;
@Return(&quot;続きは次回&quot;);
&quot;&quot; );
：
@


# Page. 22

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

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


