Brian Dunning's FileMaker Custom Functions

CustomListOLDVersion ( Start ; End ; Function )

[old version] Custom Lists - For all native functions with a number

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

Agnes Barouh   Agnes Barouh
Tic Tac
http://www.tictac.fr/CoinFileMaker/Page.html

Share on Facebook Share on Twitter

  Sample input:
CustomList ( 2; 5; "[n] & "". "" & GetNthRecord ( Field ; [n])")
  Sample output:
2. FieldRecord2
3. FieldRecord3
4. FieldRecord4
5. FieldRecord5

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

CustomList[Old] => [ you have now an Update version: Start and End Unlimited : http://www.briandunning.com/cf/868]

V.1.2 => Changed Tag "^" by "#^#"
April 04 - 2008. => V.2.3
=> Change alert error "Check Calculation"
=> result isEmpty if end or start is empty or < 1

it is not a recursive function (the recursive version is underneeth )
Carreful : Limited => End - Start < 18700 End < 18700
*this CustomList () version allow nesting of CustomList ( ) functions *

Thanks a lot to Ugo Di Luca and Fabrice Nordmann

For all native functions with a number
Left, Middle, GetValue, GetNthRecord, GetLayoutObjectAttribute (...)
or with interval CurrentDate, CurrentTime (...) or other.

CustomList can be a base for many other functions

-----------------------------------------
Nota : more calculation required in "Function" is complex, more evaluation is long

----------------------------------------- *
CustomList ( 1 ; 1000 ; "Thank you very much Ugo and Fabrice" )
----------------------------------------- *

----------------------------------------- more examples
The Argument "Function" can be :
Examples : with [n] to define the numeric list

- "GetNthRecord ( Field ; [n] )"

- """Name =>"" & GetNthRecord ( FieldName ; [n] ) & "" FirstName =>"" & GetNthRecord ( FirstFieldName ; [n] )""

- "[n] & ""."" & MiddleValues ( Field ; [n] ; 1 )"

- "GetAsDate ( Date ) + [n]"

- "GetLayoutObjectAttribute ( ""ObjectName"" ; ""Content"" ; 1 ; [n] )"

- "Let ( [ Value = GetValue ( MyList ; [n] ) ] ; Case ( PatternCount ( Value ; "X" ) ; Value ))"

- "Let ([ $$Var[[n]] = GetNthRecord ( Field ; [n] ) ] ; """" )" // To charge N variable

- "GetRepetition ( RepetitingField ; [n] )" [...]

----------------------------------------- Recursive Version
CustomList can also be recursive :
the calcul is simple but I prefer CustomList (), not recursive version is faster than CustomListRec ()

//------------------------------------------------------------------------------
/* Agnès - Juin 2007 - Thanks. - To report bugs : barouh.agnes@wanadoo.fr */
// Text lists from X to 10000

CustomListRec ( Start ; End ; Function )
Let ( [
Start = GetAsNumber ( Start ) ;
End = GetAsNumber ( End ) ;
FonctionPrepa = Substitute ( Function; "[n]"; Start );
Result = Evaluate ( FonctionPrepa )];
If ( Start < End ;
Case ( IsEmpty ( Function ) ; Start & ¶ ;
PatternCount ( Result; "?" ) > PatternCount ( Function; "?" )
or IsEmpty ( Result ) ; "" ;
Result & ¶ ) & CustomListRec ( Start + 1; End; Function ) ; Result ) )

----------------------------------------- more détails

CustomList will write your calculation like this (before evaluating it - Argument "Execute") :
CustomList ( 1; get(foundCount); "GetNthRecord ( Field ; [n])") :

Let ([ Num = 1 ] ; GetNthRecord ( Field ; Num )) & ¶ &
Let ([ Num = 2 ] ; GetNthRecord ( Field ; Num )) & ¶ &
Let ([ Num = 3 ] ; GetNthRecord ( Field ; Num )) [...]

or, when you write with "Let(["
CustomList ( 1; get(foundCount);
"Let ([ Value = GetNthRecord ( Field ; [n]) ] ; Case ( Value > 50 ; Value))") :

Let ([ Num = 1 ; Value = GetNthRecord ( Field ; Num) ] ; Case ( Value > 50 ; Value)) & ¶ &
Let ([ Num = 2 ; Value = GetNthRecord ( Field ; Num) ] ; Case ( Value > 50 ; Value)) & ¶ &
Let ([ Num = 3 ; Value = GetNthRecord ( Field ; Num) ] ; Case ( Value > 50 ; Value)) [...]

 

Comments

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.