6 Replies Latest reply on Jun 18, 2012 5:43 AM by coherentkris

    URGENT -- FMP 12 - Global Values Don't 'Stick'?

    AllegroDataSolutions

      When I set a global value through a script, FMP sometimes retains the previous value and will not let it be overwritten. This happens intermittently and unpredictably.

       

      I have also encountereda problem where individual script steps suddenly stop functioning. Deleting the script step and replacing it with the identical step (and all the same parameters, if it requires parameters) remedies the problem (but for how long, I don't know).

       

      In one script that I am working on right now, I tired to solve the first problem (global field not accepting a new value) by replacing the script set which set the value. In one instance, it worked. On the other, it won't -- no matter how many times I replace the step. The only difference between the two steps is that they target different global fields in the same table.

       

      I am about to re-write everything to use variables instead though, in the past, I have found variables to be less reliable than globals. I don't know why but sometimes a global field just works where a variable does not. I have heard a lot of other developers remark on this, but no plausible explanation or rule for when to use variables that I can rely on, so I have been using only globals to be safe.

      Needless to say, these two apparent bugs in FileMaker 12 are extremely serious. For several months, I have been working on solutions for two different clients which could be rendered useless if globals or variables do not work reliably. This effectively makes FMP 12 unreliable as a development platform until these problems can be addressed.

        • 1. Re: URGENT -- FMP 12 - Global Values Don't 'Stick'?
          monkeybreadsoftware

          First you shoudl really check if you don't have a typo there. Like you set variable and spelled the variablename a little bit wrong. I often see that problem with l (like lion) and I (like Idaho).

           

          Second with variables, people often run into scope problems. Like one script is in one database file and defines a variable and other script in other database defines same variable name, but as they are in different files, you actually have two variables.

           

          And third with our plugin we have possibility of global variables with a few functions. This way you can store values which are accessible from everywhere as long as Filemaker runs.

           

          http://www.mbsplugins.eu/component_FM.shtml

           

          And if you need persistance, you can use preferences functions, so the values survive a Filemaker restart:

           

          http://www.mbsplugins.eu/component_Preferences.shtml

           

           

          I hope this helps you.

           

          PS: Sometimes it helps to take off sunday, enjoy it with family and when you come back to office on Monday, you see the problem in a few minutes.

           

          Greetings

          Christian

          • 2. Re: URGENT -- FMP 12 - Global Values Don't 'Stick'?

            Hi Allegro,

             

            Of course we cannot pinpoint your problem without seeing your file (or at least the scripts that fail) but, although FM12 may have bugs, if globals and variables were failing there would be much of an uproar about it and I haven't read about it anywhere else.

             

            In addition to Christian's advice, how are you setting the global values?  Are you using Set Field[] or Paste or Insert Calculated[]?  Paste and Insert Calculated require the field be on the layout at the time the script runs; if not, it will fail.  With FileMaker, context is king so if you are setting related fields, it may be the context/relationship which is not correct.  If you could provide a specific example of a break, it would be easier to give you the reason for it.

             

            If you cannot post your file for review publicly, I would suggest that you contact a Developer that you are comfortable with and have them take a quick look privately.

             

            LaRetta

            • 3. Re: URGENT -- FMP 12 - Global Values Don't 'Stick'?

              Allegro said, "This happens intermittently and unpredictably ... in the past, I have found variables to be less reliable than globals."

               

              Both are very reliable if you know the rules.  The next time something doesn't work as expected, post about it immediately with the exact situation which is failing and we can help you understand why.  In this way, you will learn for the next time something strange happens.  There are always reasons - when you get a break in a process, it is a golden opportunity to learn more about FileMaker.  Bypassing these precious opportunities will lead you to false assumptions and unnecessary work.

               

              We will always be here to help you with it. 

               

              LaRetta

              • 4. Re: URGENT -- FMP 12 - Global Values Don't 'Stick'?
                psijmons

                Just a few more options that caught me by surprise in the past:

                • you may have used Get ( ScriptParameter )  where you should have used Get ( ScriptResult ) , or vice versa
                • you may have set a persistant global field by opening the file locally instead of hosted in a server

                besides the options mentioned above, global variables are very reliable and no need to doubt their performance.

                Open the dataviewer and run the debugger to see at which point your global changes, there is always a logical explanation.

                • 5. Re: URGENT -- FMP 12 - Global Values Don't 'Stick'?
                  AllegroDataSolutions

                  Unfortunately, I have not been saving versions of solution files where something doesn't work. My primary concern until this point has been to fix the bugs in the builds that my clients are seeing every day.

                   

                  With regard to the advice given on variables. I am sure that I am setting them, spelling them, and using their scope correctly. I have been developing databases for about 30 years and all of them except FileMaker (until recently) use variables.

                   

                  My question was about global fields and calc fields that don't seem to release their values and the problem, if I have not made it clear, appears to be that scripts -- and, more frequently -- individual script steps seem to be getting corrupt (i.e. just ceasing to function.) A relatively simple script, written correctly, that yeilds the correct result with the same data, suddenly stops working correctly (either stops working completely, or begins to return unpredictable results).

                   

                  Re-writing the script, or script step, exactly as it was written orginally seemes to solve the problem. Copying the step (or the script), even from an earlier build where the problem was not detected, does not. Since this is a new, clean system, that seems to have adequate specs to run FMP12, and I don't know what is causing this issue, the only way of dealing with it has been to let the script (or steps) fail and fix them when they do. Very frustrating, as well as time consuming and therefore costly, to the client.

                  • 6. Re: URGENT -- FMP 12 - Global Values Don't 'Stick'?
                    coherentkris

                    I would thoroughly investigate corruption in the file(s).