10 Replies Latest reply on Aug 11, 2011 2:24 PM by Terri

    Global Field Disappears

    Terri

      Title

      Global Field Disappears

      Post

      I have a field that is global (along with 20 other fields on this layout that are global). I enter the data and when I flip through the records it is there. When I close out of FileMaker and go back into it, it is no longer there. I've recreated the field in case it got corrupt and that doesn't help. It is definitely marked as number and the format is currency. All other fields on this layout are built the same way and stay put. Any other ideas to troubleshoot this problem?

        • 1. Re: Global Field Disappears
          philmodjunk

          Sounds like this database is hosted over the network and you are connecting to it from another computer. Changes to global field values are not retained when the file closes unless done from the "host" rather than a client.

          See these Knowledge Base articles:

          http://help.filemaker.com/app/answers/detail/a_id/5895/kw/global%20network

          http://help.filemaker.com/app/answers/detail/a_id/2984/kw/global%20network

          And if you are hosting the file with FileMaker Server, you can use a scheduled script to make permanent changes to the value of a global field as a scheduled script "runs from the host".

          • 2. Re: Global Field Disappears
            Terri

            You are right, I'm on a network. I did a little more research and figured out that was the problem. I saw two answers throughout the forum. A scheduled script or a preferences table. My global fields in this case are basically contract information. So for 21 items I have a price that has been negotiated with the vendor. These costs are what I want to store as 21 separate fields that I can then use in calculations in other fields to figure out estimates. Do you recommend a preferences table or a script? Both confuse me a bit. What is a preferences table and how does it work, in some cases I read it doesn't have to be related to anything and then in other cases I see it needs to be related by some field and then an operator of X. Which is correct?

            I apologize for my confusion and frustration. I just spent a lot of time creating these fields and then A LOT of time creating these calculations only to find when I opened the program, they disappeared. And I'm on a very tight deadline to get this done. So I appreciate your help.

            • 3. Re: Global Field Disappears
              philmodjunk

              Definitely use a preferences table for these values. That makes changing them a simple data entry process. There are two ways to make the values in the table universally accessible like your original approach with global fields:

              1. Use a script, selected in File Options to run when the file opens, to copy each value from the table into your global fields.
              2. Relate your table of values using the cartesian join operator (x) instead of = to each table occurrence where you need to access the database.

              .

              If you think about it, which approach is best depends on the design of your system. Given that you are already set up to use the global fields, the first method is probably the simplest to implement. (And you can also use scheduler to run this script once instead of File Options to run it every time the file opens...)

              • 4. Re: Global Field Disappears
                Terri

                 So, to summarize, I create a table occurance called ContractInformation that houses these 21 fields which are then just text (or in my case, number) fields. I then write a script that runs when the file is open to automatically dump these values into the global fields on my other table (which are set as global). Is the script simply a list of "set fields?" I don't want to be thinking too simplistically and then find I didn't do it right again. So...walk me through it please. FM 101. Thanks!

                • 5. Re: Global Field Disappears
                  philmodjunk

                  You've got the right idea.

                  Go To Layout [Layout to preferences table]
                  Set field
                  Set Field
                  Set Field

                  etc...

                  Go To Layout [layout where you want your users to start from]

                  • 6. Re: Global Field Disappears
                    Terri

                    Can you give some more information on the other option, not only for me in the future, but for those who are reading this and using it as a help guide (like I did with other posts). Explain how you set up the fields with another table occurance that has a relationship of X. Thanks!

                    • 7. Re: Global Field Disappears
                      philmodjunk

                      You don't set up the fields with the other option, you link in relationships to this table with the x operator and then replace references to the global fields with references to the matching fields in this table.

                      If you have a field named gValue in your current file and you need to be able to access this value from a Layout based on a table occurrence named "invoices", define a value field in Preferences for it, then define this relationship:

                      Invoices::anyfield X Preferences::Anyfield

                      Then any calculation or script step that refers to gValue, must be updated to refer to Preferences::Value instead. This eliminates the need for a script to load the globals, but can require linking numerous table occurrences of Preferences throughout your solution.

                      • 8. Re: Global Field Disappears
                        Terri

                         Phil,

                        I've mixed up these two options (actually combined them somehow) and have a script AND a relationship but now when I make updates to the "master cost" layout they don't transfer to the "linked cost" layout when I run my script. (I'm using layouts so I can visually make sure that the information is updating.) Here is what I have, please help me undo or correct the problem:

                        GlobalCostInformation Table - one record, 45 fields that house my master invoice costs. (Number fields)

                        PrintForecast Table - has the gValues in it. (Global fields)

                        Current relationship is: PrintForecast::Field1 X GlobalCostInformation::Field1

                        Hint: if I delete this relationship, all the information in my PrintForecast Table disappears. So I know I have a relationship there.

                        Script currently says (one field example)

                        Go to Layout ["Print Contract Information" (PrintForecast)]

                        Set Field [PrintForecast::PF_Cover_Run_Press_Four_Charge_RRD1; GlobalContractInfo::PF_Cover_Run_Press_Four_Charge_RRD]

                        Go to Layout ["Opening Menu" (Catalog)]

                        Please try to direct me on how to fix the script issue because I really don't have time to go fix all my calculations. Help?! Thanks!

                        • 9. Re: Global Field Disappears
                          philmodjunk

                          Note the different text I've colored Blue:

                          PrintForecast::Field1 X GlobalCostInformation::Field1
                          Set Field [PrintForecast::PF_Cover_Run_Press_Four_Charge_RRD1; GlobalContractInfo::PF_Cover_Run_Press_Four_Charge_RRD]

                          Is this a typo or is does this text exactly match what you have here?

                          In your database, syou should have exactly the same table occurrence name in both places where I show blue text.

                          Here's another way to do this:

                          Go To layout [GlobalcostInformation (GlobalcostInformation)]
                          Set FIeld [PrintForecast::PF_Cover_Run_Press_Four_Charge_RRD1 ; GlobalcostInformation::PR_Cover_Run_Press_Four_Charge_RRD ]
                          //and put your remaining set field steps here.
                          Go To layout [go to your start up layout]

                          This does not require any relationship to your "globals" table as you can refer to global fields from any layout in your file without needing a relationship to match.

                          PS. you might consider using 45 records with a pair of fields in each record. One field would be the global field's name and the other would be it's value. Then you can use a loop to load your globals and you can add more global values just by adding more records. This requires using set field by name instead of set field.

                          I also tend to use a single "Global Fields" table for defining all global fields not used in a relationship. That makes them a bit easier to keep track of during development.

                          • 10. Re: Global Field Disappears
                            Terri

                            Sorry, that was a typo.

                            Everything was fixed by changing the first "Go To Layout" script step. It was going to the wrong layout. Seems so minor in the scheme of things.

                            The loop idea makes total sense, especially since I've had to add two costs since the creation of this masterpiece.

                            And the Global Fields table is brilliant!!! I hope in my downtime (yeah, right) to clean up this database and that will definitely help in the organization.

                            I appreciate all your help. I can't even put into words how this has helped solve MAJOR problems with this project that has a very tight deadline.