ParseFieldName ( )

Function stats

Average user rating
5.0000
148
382
9999
Support
FileMaker 10.0 +
Date posted
10 July 2015
Last updated
29 December 2016
Version
Recursive function
No

Author Info
 Steve Allen

15 functions

Average Rating 5.0

author_avatar



 

Function overview

Prototype

ParseFieldName  ( field;   desired )


Parameters

field  the fully qualified field name


desired  what result you want (


Description

Tags:  ExecuteSQL  

Pass a field name gotten through GetFieldName (), and which component you want (table or field), and you'll get that back.

I use this mostly for making my ExecuteSQL functions dynamically determine the field and table names, rather than relying on static text, which is easily broken.

Examples

Sample input

ParseFieldName ( PRF_Preferences::id_constant ; "field" )

ParseFieldName ( PRF_Preferences::id_constant ; "table" )


Sample output

"id_constant"

"PRF_Preferences"

 

Function code

Let ([
    fieldName        = Substitute ( GetFieldName ( field ) ; "::" ; "¶" )
;    tableAvailable    = ValueCount ( fieldName ) > 1
;    output        =
        Case (
            desired = "table"
        and    tableAvailable
        ;    GetValue ( fieldname ; 1 )
        ;    desired = "field"
        ;        GetValue ( fieldName ; 1 + tableAvailable )
        ;    ""
        )
];
    Quote ( output )
)

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

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

    Prototype: ParseFieldName( field; desired )
    Function Author: Steve Allen (http://www.fmfunctions.com/mid/148)
    Last updated: 29 December 2016
    Version: 1.1

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

 

 

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (32)
Date  (28)
XML  (27)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Layout  (15)
Interface  (15)
Text  (14)
Variables  (13)
Filter  (12)
Layout Objects  (11)
Design  (10)
Array  (8)