SQLTable ( )

Function stats

Average user rating
375
340
9999
Support
FileMaker 10.0 +
Date posted
14 November 2012
Version
1
Recursive function
No

Author Info
 Daniel Smith

8 functions

Average Rating 5.0

author_avatar



 

Function overview

Prototype

SQLTable  ( fieldForTableNameOrTableName )


Parameters

fieldForTableNameOrTableName  (field, txt) field, fully-qualified field name, or table occurence name to extract table occurence from.


Description

Quote a table name for use in a FileMaker SQL statement. Prevent hard-coding it's value.

Examples

Sample input

table::field


Sample output

"table"

 

Function code

/* SQLTable ( fieldForTableNameOrTableName )

PURPOSE:
Quote a table name for use in a FileMaker SQL statement. Prevent hard-coding it's value.

PARAMETERS:
fieldForTableNameOrTableName (field, txt) field, fully-qualified field name, or table occurence name to extract table occurence from.

DEPENDENCIES:
FileMaker Pro 10+

REVISIONS:
2011-JUL-01    - Created by Dan Smith dansmith65@gmail.com
2012-AUG-10    - allow parameter to be a field or table name, change parameter name accordingly
####################################################################################################*/

Let (
[
    ~tableName = If(
        IsValid( GetFieldName( fieldForTableNameOrTableName ) ) ;
        GetFieldName( fieldForTableNameOrTableName ) ;
        fieldForTableNameOrTableName
    ) ;
    ~tableNameOnly = GetValue( Substitute( ~tableName ; "::" ; ¶ ) ; 1 )
] ;
    Quote ( ~tableNameOnly )
)

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

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

    Prototype: SQLTable( fieldForTableNameOrTableName )
    Function Author: Daniel Smith (http://www.fmfunctions.com/mid/375)
    Last updated: 14 November 2012
    Version: 1

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