6 Replies Latest reply on Aug 16, 2010 3:15 PM by philmodjunk

    Counters for every time a layout is accessed?



      Counters for every time a layout is accessed?


      Hello all!

      I have been given the lovely task of pruning our current FileMaker database.  To give you a snapshot of what it is, it spans five .fp7 files with over 500 layouts between them and at least 100 of them are completely blank.  There are probably about 100 tables, with some of our larger tables being duplicates of each other and wasting space.

      At this point in time, I do know what our utility screens are and only some of our "menu" screens that are used.  But there are many layouts that have been made into reports (some are the exact same reports but have just been sorted differently).  Needless to say, this is a wee bit of a disaster area since this database has gone through at least 5 to 6 different developers, me being probably lucky number 7.  

      I was wondering if there was some sort of counter that I can make to put on these layouts that still have something on them so after like a week or so, I would be able to make a fast summary of what layouts have been accessed over the last week.  I might run it for longer if I don't get any satisfying results since I do know some of them are only accessed monthly.

      My main goal after this is done is to be able to prune all layouts we don't need out (starting with the blank ones), and to implement these counters on all new layouts here on out.

      EDIT: I am using FileMaker Pro Advanced 11 on a Windows 7 OS. I always forget this part.

        • 1. Re: Counters for every time a layout is accessed?

          Glad you said you were using filemaker 11. You can set an OnLayoutLoad script trigger to log the access in a table. You can use one table and one script for this, just log both the layout name and any other data that you want (account name of user, date, time...)

          Note that blank layouts may in fact be used by scripts for vital reasons. I often use such a hidden field when I need to manipulate records in a specific table and need to avoid firing script triggers such as OnLayoutLoad in the process.

          • 2. Re: Counters for every time a layout is accessed?

            Nope I've looked at all of the blank layouts. They are literally for making breaks in the Layouts menu.

            I'm fairly new to scripting in FileMaker (aka I have one of my other IT mates do it hehe) so what would your basic script be for that?  Would I then have to put that on all of the layouts I don't know about then?

            I would definitely need to have the information of date and time to make things easier.  Account name isn't such a big deal as most of the people using the database are severely afraid to go to any other layout than the ones we usually train them to.

            Any help on this would be greatly appreciated! :)

            • 3. Re: Counters for every time a layout is accessed?

              Your script:

              Set Variable [$Layout ; Get ( LayoutName ) ]
              Freeze Window
              Go TO Layout [LayoutLogger (Layout Log)]
              New Record/Request
              Set Field [Layout Log::LayoutName ; $Layout ]
              Go To Layout [original layout]

              You can step through each layout you want to monitor and select this as the OnLayoutEnter script trigger. If you find a script is all ready attached to that trigger event, you can open that script and insert a Perform Script step that calls the above script to do the same.

              You can define date and time or a single timestamp field in Layout Log that auto enter that information when the new log record is created.

              • 4. Re: Counters for every time a layout is accessed?

                Thank you SOO much! This will help out for the pruning process.

                • 5. Re: Counters for every time a layout is accessed?

                  Now that I look at this again, I am now wondering if there would be a similar solution to being able to see what scripts are used.  We have basically the same problem with WAY too many scripts as well.

                  • 6. Re: Counters for every time a layout is accessed?

                    You could probably insert a Perform Script Call to a similar script that uses Get ( ScriptName ) to pass the name of the current script to the logging script as a script parameter.

                    You'd then use Get ( ScriptParameter ) instead of referring to a variable when logging the script call.

                    You'd have to insert this call into the beginning of every script you want to log.