9 Replies Latest reply on Feb 27, 2014 10:16 AM by philmodjunk

    Editing and locking fields when empty vs. filled

    ThomasBurke

      Title

      Editing and locking fields when empty vs. filled

      Post

           Hi, I am looking to try and create a privledge set that allows users to create new records and enter into fields that are currently empty. However it restricts them from changing any fields that already has values present in them.

            

           Tom

        • 1. Re: Editing and locking fields when empty vs. filled
          philmodjunk

               If it's a new record, at what point do you want to "lock" the nonempty fields? (Often you need to not lock them while still entering data in a new record until the data entry for that record is complete.)

          • 2. Re: Editing and locking fields when empty vs. filled
            ThomasBurke

                 I could be creating a new records with multiple fields and as long as the fields are empty i wanted to be able to edit them, and as soon a value is entered into one of the fields of the record that field would be locked from editing.

                  

                 The rational behind this is i would created a records and enter information into the fields once i do that i would like those fields locked. however i wanted to have a seprate field that someone else could later go into and identify that they QC'd my entries and they are correct.

            • 3. Re: Editing and locking fields when empty vs. filled
              philmodjunk

                   Yes, but I predict that this will not work as smoothly as you'd like. A user will enter data into a field, move to the next field and then spot their data entry error. What you want to do, however, will prevent them from editing the field the instant that they leave that field with data entered into it.

                   What I am suggesting is that the first time a record is committed with a minimal number of fields with data in them, a script sets a value in a record to "lock" it. From that point forward any non-empty field is no longer editable. This provides data entry personnel with a bit more flexibility when first adding the record to the table.

              • 4. Re: Editing and locking fields when empty vs. filled
                ThomasBurke

                     Since we are using this in a FDA regulated setting we will have different levels of access(Full access, read only, and then this custom access with data entry for blank fields but not filled fields). If an error is noticed then only those with Full access should be aloud to go back in and correct the error.  Ideally that is what we are hoping for. Until we can accomplish this we have to review the entries everytime we need to make a data submission which is tedious, so we are hoping if we can get this locked once its QC'd we will not have to worry about QC'ing it later on.

                      

                     I appreciate all of your help with this. Since i am more Science than IT do you know if there is anyplace on the forums that can help or guide with writting these scripts? I do have some computer knoweldge and i have an IT coworker but i dont know if filemaker has special scripts.

                • 5. Re: Editing and locking fields when empty vs. filled
                  philmodjunk

                       You can certainly set up script triggers on the fields that deny access to the field's if there is data already in them. This is fairly simple to set up, but also can be worked around. You'll also want to either go into preferences to disable the drag and drop option or add a second more elaborate script performed via the OnOBjectModify trigger that reverts the field to it's previous value if the user does a drag and drop on the field.

                       But the concern I am raising does not really have much to do with record level access control and your privilege sets, it has to do with typical human behavior. The odds that a typographical error will be noticed, if charted against the passing of time will resemble the right hand side of a bell curve. The odds that an error will be noted are very high the first few seconds after the user exits the field and then it tapers off. I am suggesting that if you can build in some kind of "delay" into when the field "locks down" you will get fewer delays while a higher access level person is called over to correct the issue without sacrificing the level of data integrity that you need to maintain.

                       Here's the OnObjectEnter script you could use:

                       If [ Not IsEmpty ( GetField ( GetScriptParameter ) ) ]
                         Go to object ["object name of 'safe' layout object (button or field) goes here" ]
                       End IF

                       Your Script parameter would be: GetFieldName ( YourTable::Fieldbeingentered ) // this allows system to update smoothly if you later rename the field.

                  • 6. Re: Editing and locking fields when empty vs. filled
                    ThomasBurke

                         Thank you for your help with the script to lock fields after data has been entered the field. It is perfect for what I was looking to do. I was just curious if there was a way to write 1 script to lock down every field after data has been entered into it. Or if i need to write the same script for each field? I have over 70 fields for each record in my database and was hoping i would not have to copy the script for each field. Also will this lock the field regardless of which layout I am in or would the script only be layout specific(We are looking for 1 script to covered all fields regardless of layout).

                    • 7. Re: Editing and locking fields when empty vs. filled
                      philmodjunk

                           Note that the script example uses Get ( ScriptParameter ). You can use this one script to lock down every such field on your layout. You just pass a different table::Field reference as the script parameter each script trigger that you set up on your layout.

                      • 8. Re: Editing and locking fields when empty vs. filled
                        ThomasBurke

                             is there a way to do something like
                              

                             this is what it looks like for the field File Name

                              not IsEmpty ( Unified Assay Tracking::File Name )

                              

                             Can this been done to for 1 script for all fields?

                              not IsEmpty ( Unified Assay Tracking::All Fields )

                        • 9. Re: Editing and locking fields when empty vs. filled
                          philmodjunk

                               Look at my script example:

                               Not IsEmpty ( GetField ( Get ( ScriptParameter ) ) )

                               You pass the reference to the field as a script parameter and this line of code then can be used with any number of different fields so long as you pass the reference to the field as a script parameter.

                               In your example, you use a script parameter expression of: GetFieldName ( Unified Assay Tracking::File Name )

                               Using GetFieldName insures that the script will continue to work even if you rename the table, table occurrence, or field name as it will pass the updated names to the script as a script parameter.