Brian Dunning's FileMaker Custom Functions

ntRepeat ( times ; statements ; resultValueName )

Non-Recursive Loop Statements

  Average rating: 4.7 (24 votes) Log in to vote

Norimichi Tachibana   Norimichi Tachibana
none
none

Share on Facebook Share on Twitter

  Sample input:
Let ( [ $c=0; $ret=0 ]; ntRepeat ( 10 ; "$c=$c+1; $ret=$ret+$c" ; "$ret" ) )
  Sample output:
55

* 1+2+3+4+5+6+7+8+9+10

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Repeats a group of statements a specified number of times.

[Format]
ntRepeat( times ; statements ; resultValueName )

[Parameters]
times: Repeat times. 0..1,000,000
statements: One or more statements that are repeated.
resultValueName: Variable Name as return value from this function.

 

Comments

unix   unix, Japan
Jul 16, 2014
Makes it up to 160000 times.

Case (
times > 160000 ; "?" ; times < 1 ; "?" ;
Let ( [
$stt = "Let([" & Trim ( statements ) & "];0)";
times1 = Mod ( times ; 400 ) ;
times2 = Div ( times ; 400 ) ;
$wk1 = Substitute ( 10 ^ 400 - 1 ; 9 ; "Evaluate($stt)+" ) & "0" ;
wk2 = Substitute ( 10 ^ times2 - 1 ; 9 ; "Evaluate($wk1)+" ) ;
wk3 = Substitute ( 10 ^ times1 - 1 ; 9 ; "Evaluate($stt)+" ) ;
do = Evaluate ( Case ( times2 > 0 ; wk2 ) & wk3 & "0" )
] ;
Evaluate ( resultValueName )
) // end Let
) // end Case
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.