Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 5141 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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!

Posted

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

Posted

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

Posted

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

Posted

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.

Posted

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.

Posted

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

Posted

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.

This topic is 5141 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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