4 Replies Latest reply on May 28, 2016 7:05 AM by RalphLearmont

    Default Global Container Value (Logo)?

    mercator

      Good morning,

      I am having a global container field that holds a logo. Is there a way to auto-fill this global field, i.e.: When I give an empty clone of the database to someone, I have a script execute upon opening of the FM database, checking if the global field exists, if not, I would like to set it to a default logo. How would I do that?

      Thanks a a lot,

      Helmut

        • 1. Re: Default Global Container Value (Logo)?
          keywords

          The best and most common way to deal with this issue is to create, in your globals table, a matching set of regular fields in which you store the data you want your global fields populated with by default. lThen whenever the file is opened, run a script to pass the data to the relevant global fields:

          •   standardContainerField – this one holds the logo in on-going storage

          •   globalContainerField – in a script that runs whenever the file opens, use Set Field to populate this field with the contents of the standard field.

           

          The reason for this approach is (1) a global field will hold by default whatever value it contained last time it was closed unhosted; (2) globals are different for each user session, so if you want them to always hold the same value, you must preset them and then make sure users cannot enter the fields.

           

          When you provide a clone of a file, you will need to make sure any presets in the standard fields of this table are included—in other words, you can provide empty tables for all the user data, but any background data such as logos must be included, so the file can only be a partial clone.

          • 2. Re: Default Global Container Value (Logo)?
            RalphLearmont

            Have your script test whether or not the field is empty, and if you need a field filled, use the function:

             

            GetLayoutObjectAttribute ( objectName ; "content" )

             

            In other words, keep a permanent copy of that logo on a layout somewhere (maybe along with other resources and use a  layout for that purpose).  Remember to give the logo an object name.   Have the script go to the layout, grab the logo using the GetLayoutObjectAttribute function, then return to the original layout.

             

            Ralph

            1 of 1 people found this helpful
            • 3. Re: Default Global Container Value (Logo)?
              beverly

              This seems to only work (for me) with pasted (Inserted) graphic objects. It does not seem to work with natively drawn FMP drawing objects (circles, squares, round rect, oval, lines, etc.), but Inserted Text (labels, for example) does work.

               

              Set Field ( myContainer ; "GetLayoutObjectAttribute ( "myObjectName" ; "content" ) )

              beverly

              • 4. Re: Default Global Container Value (Logo)?
                RalphLearmont

                That's true Beverly.  It's been a while since I played with this and I do now remember that limitation.  I recall using "insert picture" in layout mode to overcome this, and a quick and dirty way of capturing a native Filemaker drawn object would be to take a screen shot and reinsert it that way.

                 

                Regarding Filemaker 'text objects' it does work as I've just found out, and if there's any styling applied (in layout mode) that will also appear later in a global text field.  Without that styling override, text appears in the field's natural style.

                 

                Ralph