6 Replies Latest reply on Jun 14, 2016 10:24 AM by coherentkris

    FieldNames - Bug or not?



      FieldNames - Bug or not?


      Not all of the fields of a table I have are showing up. Specifically the field named "Msg".

      I am supplying a script with a custom dialog box I added to show the problem.


        • 1. Re: FieldNames - Bug or not?

          Here is the database manager's view of this table....

          • 2. Re: FieldNames - Bug or not?

            I would guess that the Msg field is not present on the current layout. FieldNames only returns the list of those fields actually present on the current layout.

            LaRetta recently shared an auto-enter trick that could clear a group of fields by setting the value in another field as the "trigger" to auto-enter an empty string to clear the fields.

            If ( TriggerField ; "" ; Self )

            With the do not replace existing value field cleared will clear every field with this expression when you use set field to set the value of the global number field, TriggerField to True. (Then you set it to False so that new data can be entered without it being automatically cleared.)

            • 3. Re: FieldNames - Bug or not?

              Ok. It would help if the FieldNames Doc mentioned this. I will look up LaRetta's comment.

              • 4. Re: FieldNames - Bug or not?

                Quoting from FileMaker help:


                Returns a list of the names of all fields on layoutName, in fileName file, separated by carriage returns."

                Note that the second parameter specifies a layout name rather than a table name. I would guess that, in this case, the layout and table name is the same--something automatically produced when you define a new table in FileMaker.

                • 5. Re: FieldNames - Bug or not?

                  Right. If you deliberately avoid creating a layout that is identical to the table name, you can use the table name in this function as if it was a layout name and FileMaker will act as if there is an invisible layout for that table that has every single field of that table.

                  So, if you want that method to work, you need to either:

                  1. make sure that you have no layout named the same as its table, or
                  2. make sure you put every field of the table (and ONLY those fields) on that layout.


                  Option #1 is a lot less work to keep up-to-date.

                  • 6. Re: FieldNames - Bug or not?

                    FieldNames () can be replaced with ExecuteSQL ( "SELECT FieldName FROM FileMaker_Fields WHERE TableName =?" ; "" ; "" ; "TheTableName" ) and its not bound to context.