Brian Dunning's FileMaker Custom Functions

GetTableNamesFromFieldList ( FieldList ; TableList )

Return a unique list of table names parsed by a list of fully qualified field names. Can be used to get the list of all the table occurrences that appear in the current layout.

  Be the first to rate this function Log in to vote

Federico Severin   Federico Severin - Show more from this author
Sevesoftware Engineering
http://www.sevesoftware.it

Share on Facebook Share on Twitter

  Sample input:
MainTable::Field1
MainTable::Field2
RelatedTable::FieldA
RelatedTable::FieldB
RelatedTable::FieldC
  Sample output:
MainTable
RelatedTable

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

Return a unique list of table names parsed by a list of fully qualified field names.

Parameters:
- FieldList: the list of field names.
- TableList: the list to which each new found table name will be appended. Can be an empty string, or not (see below).

E.g.: FieldList:
MainTable::Field1
MainTable::Field2
RelatedTable::FieldA
RelatedTable::FieldB
RelatedTable::FieldC

Setting TableList as an empty string (""), the result is the list:
MainTable
RelatedTable

Leaving the TableList parameter empty may seem to be pointless, but is a useful strategy to properly perform a tail recursion.
It may be useful, however, to set TableList to a non-empty value in some cases.
I.e.: when you use the FieldNames ( ) function, it will give back a list of fields where only related fields have a fully qualified name.
So, you can make a call like this:
GetTableNamesFromFieldList ( FieldNames ( Get ( fileName ) ; Get ( layoutName ) ) ; Get ( LayoutTableName ) )
to obtain the list of all the table occurrences that appear in the current layout. By the way, this is the reason why I created this function.

Federico Severin

 

Comments

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: