4 Replies Latest reply on Jan 8, 2009 7:54 AM by sulu762

    Monitoring database usage



      Monitoring database usage


      I would like to keep track of all the users of the database I am trying to design.


      In each table, I have created fields that logs when a user creates or modifies a record, but I don't know how to tie them all together.


      I tried to create a table "z_DB Maint" (with a auto entry ID number) to hold all the data.  I know that it will be the parent and the other tables will be the children in the relationship.  Each of the children tables have a foreign key that can be attached to the parent (z_DB Maint).


      What I'm having trouble understanding is how do I get the database to automatically enter records into the parent field upon User login.


      I apologize if I'm not clearly identifying my problem.  I am working on the trial version of FMP9 and only had three weeks of training in FMP (or any other database), thanks to Lynda.com.


      Any help would be appreciated.  I'll continue to search the forum in the meantime.



        • 1. Re: Monitoring database usage
          Jens Teich
             You don't need any relationship. Just create a script 'LogFile'

          * Go To Layout [LOG]

          * New Record

          * Set Field [ logFile:contentField_containingWhatHapppened ; Get( Scriptparameter ) ]

          * Go To Layout [Original]

          This script is called from startup script and the other scripts that do important things. When calling the LogFile script you pass via script parameter everything important you want to be logged.


          • 2. Re: Monitoring database usage



            I really wish I wasn't this dumb, but I understand everything except:


             Set Field [ WhatHappened ; Get( Scriptparameter ) ].


            I found the Set Field command, but do not understand what to put in the "WhatHappened" section or if I need to put anything in the "Scriptparameter" space.  I am embarrassed to admit that I am very illiterate when it comes to programming speak.


            Can you "dumb" it down for me?



            • 3. Re: Monitoring database usage
              Jens Teich
                 In the log table there is a field 'content' for the things you want to log. You call the log script with the additional ScriptParameter:

              * "Login of User " & Get( AcountName )

              and this scriptstep creates the log information

              * Set Field ( log::content ; Get( Scriptparameter ))

              After Joe logged in you find in field log::content: "Login of User Joe".

              For more explanations about script parameters see here.


              • 4. Re: Monitoring database usage



                Thanks for your patience.  It worked out great.