Brian Dunning's FileMaker Custom Functions

ListFieldsFromTable ( TableOccurrenceName )

Returns a sorted list of all Field Names for specified Table Occurrence in the current FileMaker Pro v12 file (Table Occurrence can reference external files)

  Average rating: 4.3 (36 votes) Log in to vote

Andrew Duncan   Andrew Duncan - Show more from this author
Databuzz
https://www.databuzz.com.au

Share on Facebook Share on Twitter

  Sample input:
ListFieldsFromTable ( "Contacts" )
  Sample output:
CONTACT ID MATCHING FIELD
Company
Contact Name
Contact Name Labels
Fax
First
Group
Home Address 1
Home Address 2
Home City
Home Country
Home Email
Home Phone
Home Postal Code
Home State
IM
Initial
Job Title
Last
Location GPS | iOS
Map from URL | Container
Mobile Phone
Notes
Photo Placeholder
Photo | Container
Print Selector | iOS
QuickFind | iOS
Result Label Plural
Reverse Geocoding Address | iOS
Sort List Key
Sort Selection
Title
Website
Work Address 1
Work Address 2
Work Address Short
Work City
Work Country
Work Email
Work Phone
Work Postal Code
Work State

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

Returns a sorted list of all Field Names for specified Table Occurrence in the current FileMaker Pro v12 file (Table Occurrence can reference external files). Requires FileMaker Pro v12 or higher

 

Comments

Jose   Jose, San Jose
Sep 14, 2012
Great function - thanks
 
Joshua Willing Halpern   Joshua Willing Halpern, Los Angeles
Nov 21, 2016
Hey I never use them personally but does anyone have a solution that lists each repetition of repeating fields too?
 
St. Mellios   St. Mellios, Greece
Nov 11, 2017
Is it possible to add the FieldComment functionality into this function?

Thanks
 
Andrew   Andrew
Nov 12, 2017
Joshua,

If you use this syntax:

ExecuteSQL ( "SELECT * FROM FileMaker_Fields" ; "" ; "" )

it will return additional information about the fields, not just the field name like the above custom function. For repeating fields you will get details like this:

Contacts,Address,varchar[20],66,Normal,20,2

where [20] is the number of repetitions.
 
Andrew   Andrew
Nov 12, 2017
The FileMaker_Fields virtual table doesn't return the value for the Field Comment unfortunately - you still have to use the FieldComment function to retrieve this. You could combine these so that you could query the FileMaker_Tables and then the FileMaker_Fields for each table, and build up a list of fields to pass to the FieldComment function, e.g. something like this

FieldComment ( Get ( FileName ) ; GetFieldName ( tableName::fieldName ) )

This blog post has some more details about querying the virtual tables like the above custom function for both tables and fields:

https://www.databuzz.com.au/using-executesql-to-query-the-virtual-schemasystem-tables/
 
St. Mellios   St. Mellios, Greece
Nov 13, 2017
You 're amazing.

Thank you!!!
 
Clayton King   Clayton King
Feb 21, 2021
Feeling quite dense here, but for my life, I can't figure out how to actually implement this, and it would be useful in a multi-table, multi-relationship project I'm developing.
 
Andrew Duncan   Andrew Duncan, Databuzz
Feb 21, 2021
Hi Clayton,

Start by adding the custom function to your FileMaker file, then you can reference this custom function in a calculation. For example you could have a script that sets a variable/field with this calculation:

ExecuteSQL ( "SELECT * FROM FileMaker_Tables" ; "" ; "" )

This blog post has some further examples:

https://www.databuzz.com.au/using-executesql-to-query-the-virtual-schemasystem-tables/

as does this post on filemakerhacks:

https://filemakerhacks.com/2021/01/18/file-ids-table-ids-and-field-level-schema/
 

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.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: