10 Replies Latest reply on Oct 12, 2015 4:18 PM by Mike_Mitchell

    PSA:  FieldNames() Function Affected by Layout Folder Names

    HazMatt

      Say you have a table named TestTable.  You might have a couple of layouts named TestTable Details and TestTable List.  Then you might place those layouts into a layout folder called TestTable, to keep things organized.

       

      Now, imagine you want to set up a script that does something that requires the gathering of all field names from TestTable.

       

      FileMaker provides the handy FieldNames() function:

      https://www.filemaker.com/help/14/fmp/en/html/func_ref1.32.39.html

       

      To get a list of field names on TestTable Details, you would use:  FieldNames(""; "TestTable Details")

       

      Alternatively, you can specify the actual table name, as long as there are no layouts sharing that exact name:  FieldNames(""; "TestTable")

       

      But, if a layout folder name shares the same name as the table, you will get a blank result no matter what!

       

      Nowhere is this mentioned in FMI's documentation.  I'm wondering what the purpose of this behavior is?  Is this a bug?  An undocumented feature that I'm using incorrectly?

       

      Attached is a sample file where you can see this for yourself.  Happens in FileMaker 14.0v2 on both Yosemite and "The Cap'n", as well as FM 13 on Mountain Lion.  Did not test in Windows.