3 Replies Latest reply on Apr 26, 2010 8:46 AM by JoshO.

    [ Tip ]   Insert Merge Variable



      [ Tip ]   Insert Merge Variable


      Just thought I would share this with others; especially those that have not played with merge variables yet ( dunno if it has been shared on other sites yet ).

      With the implementation of layout level variables, they can be used as layout level calculations.

      To address the refreshing of the data one could use an OnRecordLoad and call a script to refresh the data using Refresh Window [].

      However, this looks horrible with the flash particularly on Windows. A better way would just use a Freeze Window.

      To refresh the layout merge variable values just call a script with a single Freeze Window step. Allow the setting of the variable to be set as a Script Parameter. Then you can reuse that generic script everywhere.

      For example let's say that you wanted to update the record number of found count display

      Well you can use OnRecordLoad, with a script parameter of:

      Let( $$fndknt = Get ( RecordNumber ) & " of " & Get ( FoundCount ); "")

      Call the generic script which only has the Freeze Window step in it.

      On your layout, you should have the inserted Merge Variable $$fndknt on it. No more having to create a supplemental calc or use web viewer.

        • 1. Re: [ Tip ]   Insert Merge Variable

          Hi John




          The freeze step gives no flash even on Win ! ... and you could use even a simple $var !

          • 2. Re: [ Tip ]   Insert Merge Variable

            This worked as advertised and I was very happy to get rid of the clunky web viewers, but then I noticed that if you have two windows of the same layout open with different found sets, FileMaker only has one global variable to display the info, so it's going to be wrong in one window or the other. Can anyone think of a workaround for that, or is it back to the web viewers if there's a possibliity of duplicate windows?


            Images attached to show what I'm talking about.


            Two of the same window with different current records and found sets, where current/found/total are shown in a Web Viewer


            Two of the same window where current/found/total are shown with a global Merge Variable: the status bar (normally not shown) displays the correct numbers, but the merge variable shows the same in both.


            Marc Wood


            • 3. Re: [ Tip ]   Insert Merge Variable

              That is the nature of global variables.  They are not dynamic like a calculation.


              That would be a situation where you want to use an unstored calculaton instead of the Merge Variable.