2 Replies Latest reply on Jan 29, 2013 10:47 AM by pbedouk

    How to display the value of a global variable on a layout?

    pbedouk

      Title

      How to display the value of a global variable on a layout?

      Post

           Hi

           I have a customers table and a layout where I browse through the table using button/scripts for first, next, previous and last.

           In the table I defined 2 global fields to hold the FoundCount and RecordNumber so I can display "Customer x of y" on the layout.  These values change as I browse through the records.  It all works fine.

           But I see that the global fields are present in every record, as they should be I guess.  So in the interests of delevoping a cleaner solution, and improving my technical prowess, I thought I'd use global variables instead to hold the values for FoundCount and RecordNumber.

           Now I can't figure out how to display those global variables on my layout.

           One thought I had is to create a 1 record table to hold the values of the 2 global variables in 2 fields, and then display that field on the layout.  But then that has to be a related table visible from the customer table.  Seems overly complex for such a simple thing.  Is there a better way?

           Suggestions?

            

           Thanks!

           Peter.

        • 1. Re: How to display the value of a global variable on a layout?
          philmodjunk

               Global fields can be defined in any table in your database and will still be accessible from any layout and any script in your file. The only time you need to put a global field in a specific table is if it is used as the match field in a relationship.

               Thus, you may want to add a "globals" field to your database as the place to put all of your global fields.

               If you are using Filemaker 11 or newer, you can pull down the Insert Menu while in layout mode and use the Merge Variable option to add a merge variable to your layout. This puts <<$$>> on your layout and you'll then need to type in the name of your variable.

               If you are using an older version of Filemaker, you can't display a variable's value on a layout and you'll need to stick with global fields.

          • 2. Re: How to display the value of a global variable on a layout?
            pbedouk

                 Thanks!

                 I had created a "globals" table, but neglected to define the fields as global fields.  Once I did that, they displayed on the layout.

                 Using FM12.