FM.table.info ( )

Function stats

Average user rating
37
327
9999
Support
FileMaker 10.0 +
Date posted
05 April 2012
Version
1
Recursive function
No

Author Info
 Fabrice

71 functions

Average Rating 4.4

author_avatar



 

Function overview

Prototype

FM.table.info  ( _tableName )


Parameters

_tableName  can be a table name, a table ID, or a full field name


Description

Tags:  table   sql   Dev   design  

Design function.
Returns table occurrence information as XML

Parameter : can be a table name, a table ID, or a full field name

FileMaker 12 required.

Examples

Sample input

FM.table.info ( "myTO::myField" )


Sample output

<TABLE>
    <TABLE.NAME>myTO</TABLE.NAME>
    <TABLE.ID>1065106</TABLE.ID>
    <TABLE.BASETABLE>The real base table name</TABLE.BASETABLE>
    <TABLE.BASEFILE>The file name</TABLE.BASEFILE>
    <TABLE.MODECOUNT>4</TABLE.MODECOUNT>
</TABLE>

 

Function code

/* FM.table.info ( _tableName )

by Fabrice Nordmann, 1-more-thing

http://www.1-more-thing.com
http://www.twitter.com/1morethingtweet


Design function.
Returns table occurrence information as XML

Parameter : can be a table name, a table ID, or a full field name

FileMaker 12 required.

v1 - Apr 2012
*/

Let ([
    _tableName = _tableName ; // so you can easily copy to dataviewer or calculation box
    _tableName = GetValue ( Substitute ( _tableName ; "::" ; ¶ ) ; 1 ) ;
    _tableName = Substitute ( FilterValues ( TableNames ( Get ( FileName )) ; _tableName ) ; ¶ ; "" ) ; //to adjust the case
    _info = Case ( Filter ( _tableName ; 1234567890 ) = _tableName ;
        ExecuteSQL ("SELECT TableName, TableID, BaseTableName, BaseFileName, ModCount FROM FileMaker_Tables WHERE TableID='" & _tableName & "'" ; ¶ ; "" ) ; // match by ID
        ExecuteSQL ("SELECT TableName, TableID, BaseTableName, BaseFileName, ModCount FROM FileMaker_Tables WHERE TableName='" & _tableName & "'" ; ¶ ; "" ) // match by Name
        )
];

Case (
    IsEmpty ( _info ) or _info = "?" ; _info ;
    xmlSet ( "TABLE" ;
        Substitute (
        ¶ &    List (
            xmlSet ( "TABLE.NAME" ; GetValue ( _info ; 1 )) ;
            xmlSet ( "TABLE.ID" ; GetValue ( _info ; 2 )) ;
            xmlSet ( "TABLE.BASETABLE" ; GetValue ( _info ; 3 )) ;
            xmlSet ( "TABLE.BASEFILE" ; GetValue ( _info ; 4 )) ;
            xmlSet ( "TABLE.MODECOUNT" ; GetValue ( _info ; 5 ))
        )
        & "#CR#"
        ; [ ¶ ; "¶    " ] ; [ "#CR#" ; ¶ ] )
    )
)
)

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

    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/327

    Prototype: FM.table.info( _tableName )
    Function Author: Fabrice (http://www.fmfunctions.com/mid/37)
    Last updated: 05 April 2012
    Version: 1

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

 

 

 

 

 

 

 

Related Functions

Required functions