1 2 Previous Next 16 Replies Latest reply on Aug 11, 2016 8:51 AM by philmodjunk

    Save Record and Prevent Changes to it

    goldencode

      Hi everyone,

       

      Filemaker Pro 15 saves records automatically, but what i want is to fill the form with the required data without saving and there is a button that says " Save Record", if i click that button then the data are saved and after it is saved then the record is no longer editable..

       

      So is it possible to achieve this with Filemaker Pro 15?

       

      Thanks everyone for your time.

        • 1. Re: Save Record and Prevent Changes to it
          philmodjunk

          There are several possible approaches.

           

          One method is to set up a layout for this purpose where you define and place global fields that correspond to each user editable field of your record. Your "save" button then uses set field to transfer the data from the global fields to a new record in your table. You then control which records can be edited by using scripts to transfer the data back into the global fields.

           

          There are also ways to use record level access control inside Manage Security to control when a given record can or cannot be edited. For example, I created an invoicing system where, when the record's status field changes to "printed", the average user can no longer edit the record because there access privileges do not allow them to do so.

          1 of 1 people found this helpful
          • 2. Re: Save Record and Prevent Changes to it
            goldencode

            Thanks a lot for the reply philmodjunk

             

            I will try the proposed methods and i will keep you updated soon

            • 3. Re: Save Record and Prevent Changes to it
              goldencode

              philmodjunk

               

              The first step is clear but may you please explain this step further:

               

              "Your "save" button then uses set field to transfer the data from the global fields to a new record in your table"

               

              So, how would i transfer the data from the global fields to a new record?

               

              Thanks again

              • 4. Re: Save Record and Prevent Changes to it
                beverly

                Script:

                New Record

                Set Field ( firstname ; firstname_g )

                Set Field ( lastname ; lastname_g )

                .... repeat for each global field

                Commit Record

                 

                I typically clear the global fields at the end of the script (or call a subscript to clear them), unless they are further needed in the script.

                 

                Global fields are session/user specific, so several people can use them this way and there is no problem.

                 

                beverly

                2 of 3 people found this helpful
                • 5. Re: Save Record and Prevent Changes to it
                  goldencode

                  Thanks a lot

                   

                   

                  I have tried the second method (from security controls) and it works great but the only problem is that the record becomes non editable only when i logout and login back, so can i overcome this using a script without logging out?

                   

                  philmodjunk, said in the first reply:

                   

                  "when the record's status field changes to "printed", the average user can no longer edit the record because there access privileges do not allow them to do so."

                   

                  So how can i achieve that? What if i want the record to be saved + becomes non editable with a click of a button?

                   

                  You are awesome! I couldn't imagine getting this amount of great help in no time, really appreciated and i'm really impressed

                  • 6. Re: Save Record and Prevent Changes to it
                    keywords

                    Just adding to Beverly's script steps, before the New Record step you need to make sure the script navigates you to the correct Table, otherwise the New Record could have unexpected consequences.

                    Further, I use a similar method to keep users out of the main table in a Cash Book database; it enables all manner of data checking and standardising within the script that actually posts the data into the permanent record. In my case I don't use global fields but rather a temporary record in a separate data entry table as that gives me better flexibility.

                    To prevent changes to the stored data, apart from the method suggested by philmodjunk, you can also use field validation. I have a couple of binary Lock fields that are set to 1 when certain functions are performed (e.g. bank rec or tax reporting) after which data must not be changed. Then I set field validation to prevent change if the lock field(s) equal 1. It is simple and effective.

                    • 7. Re: Save Record and Prevent Changes to it
                      goldencode

                      I have found this, i have tested the saving button, it works as it should. The only remaining step is to make the record non editable after it has been saved..

                      • 8. Re: Save Record and Prevent Changes to it
                        beverly

                        Sorry, I'm not seeing the entire thread. I answered how to set fields with global values. I will check what you are saying when I'm back online.

                         

                        Sent from my miPhone

                        • 9. Re: Save Record and Prevent Changes to it
                          beverly

                          What privileges are you using? What menus are you using? If these have been answered, I'll see later.

                           

                          Sent from my miPhone

                          • 10. Re: Save Record and Prevent Changes to it
                            goldencode

                             

                             

                            Custom privileges

                             

                            For Records:

                            View>Yes

                            Edit>No

                            Create>Yes

                            Delete>No

                            Field Access>All

                             

                            For Layouts:

                            Layout>View Only

                            Records via this layout>Modifiable

                             

                            Value Lists:

                            All View Only

                             

                            Scripts:

                            All Executable Only

                             

                            Other Privileges:

                            Available Menu Commands>All

                             

                             

                            Thanks a lot for your time,

                            • 11. Re: Save Record and Prevent Changes to it
                              beverly

                              the record should be "editable" until it is committed. are you saying that relogin is needed?

                               

                              also, if you use Global (storage) fields for entry and script the Set Field(s), then you can also prevent entry into the fields (through Inspector).

                               

                              remember that with script privileges it may be possible to change data (your admin permission for example).

                              beverly

                              • 12. Re: Save Record and Prevent Changes to it
                                goldencode

                                What i have done is that i have added a script with the following step to a button called "Save Record":

                                 

                                Commit Record/Requests [With dialog:Off]


                                I don't know if this is the right way but this is what i have used, however if i click the "Save Record" button i still can edit the data regardless of the set privileges, but if i exit the application and then login, the records become non editable..So did you mean that once the record is committed it should be non editable automatically according to the set privileges without using additional scripts or any triggers?

                                 

                                In this topic: How to get rid of "Save changes to this record"

                                 

                                A boolean and a variable of 0,1 values are used to verify if the record is committed with the help of both buttons and layout triggers.

                                • 13. Re: Save Record and Prevent Changes to it
                                  goldencode

                                  Finally i have achieved it!

                                   

                                  I have followed this:How to get rid of "Save changes to this record"

                                   

                                  Then i have added the following script with the OnObjectEnter Trigger to each field that i don't want it to be editable once the record is committed:

                                   

                                  If [not IsEmpty (Get(ActiveFieldContents)) and table_name::commit]

                                       Go to Field []

                                  End If

                                   

                                  If there is another way of doing it without assigning the above script to each field that should be different time-saving way to use if all field must not be editable..

                                   

                                  Thanks a lot everyone for your assistance,

                                  • 14. Re: Save Record and Prevent Changes to it
                                    brucewilson

                                    You can select multiple fields, and then Set Script Trigger for all of them at once.

                                    1 of 1 people found this helpful
                                    1 2 Previous Next