4 Replies Latest reply on Apr 24, 2014 2:23 PM by FentonJones

    Exporting field comments?



      Exporting field comments?


           I'm trying to export field names, field types, and field comments for a particular table in Filemaker.  Bonus if I can export the text value of the field options as well.  Specifically the values that I want are the ones that show up in the Manage -> Database -> Fields view of a particular table.

           I've found instructions for exporting field names and even field types, but can't find any instructions for exporting comments or options.

           Can anyone help with this?  I'm using Filemaker 12.0v4.

           Thanks in advance for any assistance.



        • 1. Re: Exporting field comments?

               If you have advanced, and do a database design report i believe the comments are in the report. Tools | Database Design Report

          • 2. Re: Exporting field comments?

                 Thank you, Marc.  That is a bummer as I do not have Advanced.  I did not even know there was such a thing.

            • 3. Re: Exporting field comments?

                   Would this work?


                   FieldComment ( fileName ; fieldName )

              • 4. Re: Exporting field comments?


                     I never really needed this method to view the Comments (other than the default, just viewing in next to the fields). I could also view/sort/find them in a FileMaker file/app which goes thru must of what FileMaker Pro Advanced can export as XML via the Database Design Report. But I thought I'd give it a try using the built-in tools; after all, FM made them available. It took me a while to figure out what would work best, and this is the script I created. I will add it here as text. Hopefully it will work, for any file/table. The script itself does not require any particular table or layout. But you should run the script after going to a layout which belongs to the table you want to see the "comments" from. It will return a list with:

                     field name tab comment

                     It will get every field of that table which has a comment.


                     You can view the list with the Data Viewer (that is also viewable in FileMaker Pro?). It is in a Variable, named "$$fields|comments" (global, so will last until you close the file). You can them copy/paste it to a text editor of your choice. If you want, you could add script steps to set it into a global field, then use Export Field Contents to create a text file with it. 


                     The default sort of the list will be whatever FM wants; I can make no sense of what it uses for this, as it is not any order I can even guess at. Personally, I would add using a Custom Function to "sort" the value of the fields list as a script step (before it starts going thru them). But that requires a CF, which only FileMaker Pro Advanced would let you add. [ I do not know of any simple "sort values in a list which is just text" (not records). I use a CF called "Quick Sort" (which is actually 3 CFs); you can find it online, at the usual places.]


                     Anyway, for those who want to try this. Please try it on a copy of your file, NOT your main live file. But it seems to run OK. It does not use the records. I ran it on a (local) file, with 544 fields (ycks), with 132 Comments. It only took a second to run (maybe 2 if you sort). So it is not slow (on local file). Oh, one more thing: In a Variable, they words "; Value:" is NOT part of the Variable; that's just where it asks for the value. So, first you past the name (such as "$layout_table", then you past the value, into its area (such as "Get (LayoutTableName)". See below. In the final one below, after the "Value:" is the calculation below; I tried to make this visibly aware.



                     # Fields Comments simple


                     Commit Records/Requests [ No dialog ]


                     Set Variable [ $$fields|comments; Value:"" ] 

                     Set Variable [ $layout_table; Value:Get (LayoutTableName) ] 

                     Set Variable [ $fields_names; Value:FieldNames ( Get (FileName); $layout_table ) ] 

                     Set Variable [ $fields_cnt; Value:ValueCount ( $fields_names ) ] 



                     Set Variable [ $num; Value:$num + 1 ] 

                     Exit Loop If [ $num > $fields_cnt ] 


                     Set Variable [ $field_name; Value:GetValue ( $fields_names; $num ) ] 

                     Set Variable [ $comment; Value:FieldComment ( Get (FileName); $layout_table & "::" & $field_name ) ] 


                     If [ not IsEmpty ( $comment ) ] 

                     Set Variable [ $$fields|comments; Value:

                     Let ( 

                     $field|comment = $field_name & " " & $comment; // tab between 

                     Case ( not IsEmpty ($$fields|comments); $$fields|comments & ¶ ) & $field|comment



                     End If 

                     End Loop