Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Defined Field Name List Or Count By Table

Featured Replies

Hi All!

Just wondering if anyone knows of a way to garner the list of fields by name or a simple count of fields in a given table. I am aware of the FieldNames() and FieldIDs() functions. However, these functions will only return those FieldNames or FieldIDs for fields that exist on a specified layout. I'm looking to simply get a list or count of fields from a specified table.

Happy Holidays!

Dear Matt,

I think the easiest is to run Database Design Report if you have FileMaker Pro Advanced.

Else, consider doing either of the following:

1. Create a layout with all fields for each table and use the FieldNames ( File Name; "").

2. For a more dynamic method do:

a. Use TableNames( File Name ) to get a list of Tables and split them into records ( 1 Record for 1 Table ).

b. Use FieldNames ( File Name; Table Name) to get a list of Fields for the Table.

Regards,

Omega Goh

Speedy Scaleable Solutions

Your assumption is incorrect. The existing function will successfully return all field names. However, if the layout and table occurrence are named the same, it will only return the list of fields on the layout. Be sure to refer to a table occurrence name that is not the same as a layout name; change one or the other if necessary.

http://fmhelp.filemaker.com/fmphelp_11/en/html/func_ref1.31.31.html#1029384

Dear Bruce,

Thanks for pointing to the (official) documentation and suggesting to name Layout different from Table Occurrence.

However, I strongly encourage you to download the attachment to see that I wasn't wrong (tested with FMPA8.5 and FMPA11; non-officially it works!).

Regards,

Omega Goh

Speedy Scaleable Solutions

Your assumption is incorrect. The existing function will successfully return all field names. However, if the layout and table occurrence are named the same, it will only return the list of fields on the layout. Be sure to refer to a table occurrence name that is not the same as a layout name; change one or the other if necessary.

http://fmhelp.filema...31.html#1029384

Table vs Layout Field Names.zip

What is it that you think the file demonstrates? It seems to me that it reinforces my point. When the function is called on the table occurrence it gets all field names.

Dear Bruce,

If I didn't get Matt wrong, he is interested in getting either a list of field names or a count of number of fields of a specified table.

He also mentioned that FieldNames ( ) only returns a list of field names from a specified layout, which you had pointed me to the official documentation.

What I was saying is, while it is not in the official documentation, FieldNames ( ) can return a list of field names from a table (occurence), which is exactly what Matt wanted.

I hope that I had make myself clear is round.

Regards,

Omega Goh

What is it that you think the file demonstrates? It seems to me that it reinforces my point. When the function is called on the table occurrence it gets all field names.

As I pointed out, the official document DOES indicate that fields are listed for a table occurrence.

  • Author

No need to argue about it guys. You both accurately pointed out that, though the FieldNames() function's second parameter is called "layoutname", you can actually use a table occurrence name.

Also, I believe that Bruce was referring to MY assumption that the function would only return a list of field names that existed on the specified layout. I did make assumptions based on the parameter name rather than reading the documentation on the function.

Thank you BOTH for pointing me in the right direction.

Happy Holidays.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.