6 Replies Latest reply on Feb 7, 2010 7:09 AM by LeoB

    Complicated UserName Issue

    LeoB

      Title

      Complicated UserName Issue

      Post

      If anybody has the time to bear with me, I've come across a problem that I haven't a clue how to fix.

       

      Simple database -- two tables: Activities and Issues.

       

      In both tables I have fields fors CreatedBy, CreatedDate, ModifiedBy, and ModifiedDate.  All work fine.

       

      In both tables I also have fields for ApprovedBy and ApprovedDate.  In UAC I have separate authorities (User and Manager) so that regular users cannot access (but can see) these fields.  Works fine.

       

      I created an "Approved" button to run a script to insert AccountName in the ApprovedBy field and CurrentDate in the Approved Date fields. In UAC this script can only be accessed by somebody logging in as a manager. This works fine, BUT.

       

      The AccountName (ApprovedBy) is pulling in the name off the computer, not the log-in name.  Although this is OK most of the time, a manager may log in from another computer and then the wrong info will be logged.  Also, every time the button/script is run, it modifies the ModifiedBy/ModifiedDate fields, even if the manager has not actually modified the contents of the record.

       

      My two (related?) questions are:

       

      1.  How do I get the Approved button/script to insert the logged in name and not the name in the computer (AccountName)?

      2.  How can I stop the record from showing a new ModifiedBy name and date if the manager hasn't actually modified it?  I would want it to show the manager's name if the manager actually modified any of the data in the record so the creator would know.  In fact, later on I may try to set up a Layout for each user to show any records that have been modified by others.

       

      All help greatly appreciated.

       

       

       

       

        • 1. Re: Complicated UserName Issue
          deltatango
            

          Answers to your questions: 

           

          1. I think you have them mixed up.

           

          Account Name is the currently user who is logged into the file. This is what you log into Filemaker with.

           

          User Name is the name of the computer.

           

          What you want is the Account Name.

           

          2. Create another text field, double click it and choose "Modification: Account Name"

           

           Every time the record is modified, it will enter the account name of the user who modified it.

           

          You can also create date/time/timestamp fields, etc that will enter date when modified. 

          • 2. Re: Complicated UserName Issue
            LeoB
              

            deltatango:

             

            1.  I had them backwards.  It is set for AccountName, but it is entering the User Name off the computer.  It should be entering Admin as that is what I am logged in as.  In the CreatedBy and ModifiedBy fields, it correctly enters AccountName (Admin), but those are set in the field attributes.  For the ApprovedBy field it's set by a script on the button, which is:

             

            Insert Current User Name [Select; Activity::ApprovedBy]

            Insert Current Date [Select; Activity::ApprovalDate]

             

            2.  I already have that set up, and it works fine.  What I'm trying to do is let the Manager approve the record but not enter the manager's account name unless the manager modifiesany other field in the record besides triggering the Approval script.

             

            Thanks

            • 3. Re: Complicated UserName Issue
              hbrendel
                

              @1

               

              Insert Current User Name is: ... inserting the UserName

              Set Field [Activity::ApprovedBy; Get ( AccountName )] will insert:  what do you guess?

              • 4. Re: Complicated UserName Issue
                LeoB
                  

                That did it!  Now, that script works perfectly.

                 

                Now if I can just figure out the second part -- how to have that script run and NOT change the ModifiedBy/ModifiedDate fields unless the manager actually modifies any other fields.

                • 5. Re: Complicated UserName Issue
                  deltatango
                    

                  You can use Evaluate

                   

                  Turn off the modification information.

                   

                  Make it an calculated value,

                   

                  And then, for example in the modifierUser field, use:

                   

                  Evaluate("Get(AccountName)"; [fieldToActivateIt; fieldToActivateIt; fieldToActivateIt; fieldToActivateIt; fieldToActivateIt]) 

                  • 6. Re: Complicated UserName Issue
                    LeoB
                      

                    OK -- gotta go and read up about Evaluate function.  Never used that before.

                     

                    Thanks