「JTスぺ-ス1とかで検索したい!」
とかいう人のために。
--------------------------------------------------------------
計算フィールの結果(テキスト)
J
JT
JT0
JT00
JT000
JT0000
JT00000
JT000000
JT0000000
JT00000001
T
T0
T00
T000
T0000
T00000
T000000
T0000000
T00000001
0
00
000
0000
00000
000000
0000000
00000001
0
00
000
0000
00000
000000
0000001
0
00
000
0000
00000
000001
0
00
000
0000
00001
0
00
000
0001
0
00
001
0
01
1
-----------------------------------------------
計算式フィールドの中身
AllSubstrings ( 商品No )
(テキスト)非保存にしないでねw
-------------------------------------------------
「ホレ、なんもかんもバラバラにしちゃいなさいや!」というカスタム関数を3つ作るのさ。
なんもだから・・・
-----①関数------
関数名:AllSubstrings
引数:str
/*----------------------------------------------------------*/
Let (
[
len = Length ( str )
] ;
If ( len = 0 ; "" ;
SubstringFrom ( str ; 1 ) & ¶ & AllSubstrings ( Middle ( str ; 2 ; len - 1 ) )
)
)
/*---------------------------*/
-----②関数----再起処理-----
関数名:SubstringFrom
引数:str;start;
/*----------------------------------------------------------*/
If ( start > Length ( str ) ; "" ;
Let (
[
acc = ""
] ;
Let (
[
end = Length ( str ) ;
result = RecursiveJoin ( str ; start ; start )
] ;
result
)
)
)
/*---------------------------*/
-----③関数------
関数名:RecursiveJoin
引数:str;start;current
/*----------------------------------------------------------*/
If ( current > Length ( str ) ; "" ;
Left ( str ; current ) & ¶ & RecursiveJoin ( str ; start ; current + 1 )
)
/*---------------------------*/
わやだぁ