fm.field.list ( )

Function stats

Average user rating
37
357
9999
Support
FileMaker 10.0 +
Date posted
30 August 2013
Last updated
02 September 2013
Version
Recursive function
No

Author Info
 Fabrice

74 functions

Average Rating 4.4

author_avatar



 

Function overview

Prototype

fm.field.list  ( _begin.string.list;   _omit.string.list )


Parameters

_begin.string.list  a ¶ separated value list to include fields whose name starts with one of the values


_omit.string.list  a ¶ separated value list to omit fields starting with one of the values


Description

Tags:  Sql   List   Design  

returns a list of full filed names in all tables of the current file, starting with the _begin.string and omitting field beginning with one of the values in _omit.string.list

_begin.string : what the field name should begin with, or "*" for the complete field list.
_omit.string.list : a ¶ separated value list to omit fields starting with one of the values.

Sample
fm.field.list ( "ID_contact" ; "ID_contactAddress¶ID_contactPhone" ) -> a list of all fields in the database beginning with ID_contact but not with ID_contactAddress or ID_contactPhone
fm.field.list ( "*" ; "zzz" ) -> a list of all fields in the database not beginning with zzz.
fm.field.list ( "*" ; "" ) -> a list of all fields in the database.

Requires FileMaker 12

Examples

Sample input

fm.field.list ( "ID_contact" ; "ID_contactAddress¶ID_contactPhone" )


Sample output

a list of all fields in the database beginning with ID_contact but not with ID_contactAddress or ID_contactPhone

 

Function code

/*
fm.field.list ( _begin.string.list ; _omit.string.list )
by Fabrice Nordmann, 1-more-thing
http://www.1-more-thing.com
Twitter: 1morethingtweet

v2 Sept 2013 - by Agnès Barouh (Thanks !!!)
- first parameter modified and accepts a list
- correctly evaluates server side
- does not require FilterList()
v1 Aug 2013

returns a list of full filed names in all tables of the current file, starting with the _begin.string and omitting field beginning with one of the values in _omit.string.list

_begin.string.list : a ¶ separated value list to include fields whose name starts with one of the values, or "*" for all fields
_omit.string.list : a ¶ separated value list to omit fields starting with one of the values.

Sample
fm.field.list ( "ID_contact" ; "ID_contactAddress¶ID_contactPhone" ) -> a list of all fields in the database beginning with ID_contact but not with ID_contactAddress or ID_contactPhone
fm.field.list ( "*" ; "zzz" ) -> a list of all fields in the database not beginning with zzz.
fm.field.list ( "*" ; "" ) -> a list of all fields in the database.

Requires FileMaker 12

*/
Let ([
    $cf.begin.string.list = Upper ( _begin.string.list ) ;
    $cf.omit.string.list = Upper ( Case ( not IsEmpty ( _omit.string.list ) ; "::" ) & _omit.string.list ) ;
    $cf.table.list = fm.table.list.unique ;
     _field.list = CustomList ( 1 ; ValueCount ( $cf.table.list ) ; "Let ([ _t = GetValue ( $cf.table.list ; [n]) ]; Substitute ( \¶ & FieldNames ( Get ( FileName ); _t ) ; \¶ ; \¶ & _t & \"::\" ))" ) ;
    $cf.NoCase = Upper ( _field.list ) ;
    Eval = Evaluate (
        "Substitute ( $cf.NoCase ;" & "[\"" & Substitute ( $cf.omit.string.list ; [ ¶ ; "\";\"XXXX\"] ; [\"::" ] ) & "\";\"XXXX\"]"
        & Case ( $cf.begin.string.list <> "*" ;
        Substitute ( CustomList ( 1 ; ValueCount ( $cf.begin.string.list ) ; "Let ([ V = GetValue ( $cf.begin.string.list ; [n] ) ]; \";[\"\"::\" & V & \"\"\";\"\":#:\" & V & \"\"\"]\" )") ; "¶;" ; ";" )
        & ";[ \"::\" ; \"\" ];[ \":#:\" ; \"::\" ]" ) & ")"
    ) ;
    $cf.begin.string.list = "" ; $cf.omit.string.list = "" ; $cf.table.list = "" ; $cf.NoCase = ""
];
    FilterValues ( _field.list; Eval )
)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/357

    Prototype: fm.field.list( _begin.string.list; _omit.string.list )
    Function Author: Fabrice (http://www.fmfunctions.com/mid/37)
    Last updated: 02 September 2013
    Version: 2.0

*/
// ===================================