繰り返しフィールドで、最後の入力値がある繰り返し位置の番号を返します。

function(関数):
Sample input(入力例):
Sample output(出力例):
formula(式):

/*
  Return the repetition number of "Last ( Repetition Field )".
  最後に入力値がある繰り返しの位置番号を返します。

  Author : Shoichi Miyamura (宮村 昌一)
  Creation Date : August 31, 2021
*/

While ( 

  [ 
    @Max = Count ( RepField ) ; 
    @Inc = 0 ; 
    @Num = 0 
  ] ; 

  GetAsNumber ( @Num ) < GetAsNumber ( @Max ) ; 

  [ 
    @Inc = GetAsNumber ( @Inc ) + 1 ; 
    @Num = 
      Case ( not IsEmpty ( GetRepetition ( RepField ; @Inc ) ) ; 
        GetAsNumber ( @Num ) + 1 ; 
        GetAsNumber ( @Num ) 
      ) // Case
  ] ; 

  GetAsNumber ( @Inc ) 

) // While