8 Replies Latest reply on Mar 13, 2013 3:37 PM by hobbiesdeveloper

    Global Field Value Not Saving

    hobbiesdeveloper

      Title

      Global Field Value Not Saving

      Post

           I have setup a Global Text Field value for recording the date everytime the script runs. After the script completes it sets the field to the Current Date for all records but when you exit out of Filemaker and re-login it does not show the dates in the Global Text Field?

            

           Please let me know what might be the cause of not saving the values?

           After you exit filemaker it just clears the values.

           I need it to save the current date of each time the script runs but not sure how to resolve this problem using this method?

            

           Thanks.

        • 1. Re: Global Field Value Not Saving
          philmodjunk

               With a global field, you can store one and only one date in the global date field. You'd have to modify the value in this field each time you open the database anyway. And an unstored calculation field could show today's date without any need for a script to update it.

               If your file is hosted from another computer any change you make to a global field will not persist nor will changes you make to the value in this field be visible to other users. This is by design as it allows you to use global fields in hosted databases in ways that keeps the input from one user from interfering with what a different user is doing.

               You can either store the value in a non global field--possibly in a special table defined for that purpose, or you can use a start up script to load your global fields with values each time a user opens the database. Or you can make changes to the value in the global field from the host computer. If you use FileMaker Server to host your database, this can be done from a script furn from a server schedule.

               Here's a knowledgebase article on global fields that you may find helpful: http://help.filemaker.com/app/answers/detail/a_id/3604/kw/global

          • 2. Re: Global Field Value Not Saving
            hobbiesdeveloper

                 How would I be able to modify this value in all 40,000 records for each script. I tried to do it by modifying the field for each record but took over an hour :(

                 I have the database running from a server location, would I be able to modify the global value from a client computer like running initiating a script from a client computer to run on the server machine?

                  

                 Thanks for your help.

            • 3. Re: Global Field Value Not Saving
              philmodjunk

                   I suggest that you explain how the date in this field is used. I never suggested that you use a stored field in the same table as the rest of the data. You can put the value in a single record in a related table that links to all 40,000 records, but from what you describe here, I'm not convinced that you need use any field to store today's date.

              • 4. Re: Global Field Value Not Saving
                hobbiesdeveloper

                     I currently have the date field set as a regular text field using the Global feature. Also, my script would set the field with the Current Date but due to this being a Global Field it changes them automatically for all records with that field.

                      

                     Hope that helps.

                • 5. Re: Global Field Value Not Saving
                  philmodjunk

                       It doesn't really help and it should not be a text field. It should be a field of type date. If you are recording multiple dates in a list, these should be separate dates in a field of a related table.

                       To repeat:

                       explain how the date in this field is used.

                       What do you want to do with the date data in this field?

                  • 6. Re: Global Field Value Not Saving
                    hobbiesdeveloper

                         I'm only recording one date. Basically, each time I run the eBay Update script it should record the current date revised.

                         Here is what I have:

                          

                         Table Name: Product

                         Field Name: FL_qty

                         Options: Global

                         Here is the script that I run to do the eBay Update with the values below:

                         Set Field [Product::FL_qty; Get( CurrentDate )]

                          

                         Hopefully this is the info you are asking for.

                    • 7. Re: Global Field Value Not Saving
                      philmodjunk

                           Do you only need to keep track of the last date when this script was run or do you want to keep a record of each date when this script was run?

                           A single date:

                           Freeze Window
                           Go to Layout ["DateLastUpdate" (DateLastUpdate) ]
                           Set Field [DatelastUpdate::Date ; Get ( CurrentDate ) ]
                           Go to Layout [original layout]

                           keep all past dates:

                           Freeze Window
                           Go to Layout ["DateLastUpdate" (DateLastUpdate) ]
                           New Record/Request
                           Set Field [DatelastUpdate::Date ; Get ( CurrentDate ) ]
                           Go to Layout [original layout]

                           On any layout where you need to see this date, add a relationship to a Tutorial: What are Table Occurrences?of DateLastUpdate. In both cases, you can use the X operator and match any field in the layout's table to any field in the DateLastUpdate table. In the case of saving all past dates, go to this relationship and specify a sort order for the occurrence of DatelastUpdate that sorts on the Date field in descending order.

                           Then, in either case, you can add the date field from this added table occurrence to your layout.

                           Ps. If you need to see this info in many layouts based on many different tables, you can add your global field back in, but use a script performed each time that the file is opened to set the global field to the value of DatelastUpdate::Date.

                      • 8. Re: Global Field Value Not Saving
                        hobbiesdeveloper

                             Perfect.

                             That's what I was looking for.