2 Replies Latest reply on Sep 16, 2009 10:11 AM by MartinBrändle

    PHP API and Global fields



      PHP API and Global fields

      Your post

      In my Filemaker database, I have a global field that is set to the fiscal year. MANY calculated fields and field validation rules reference this field. I have setup a script that sets this global field upon file open. With the client and IWP, everything works great. My problem is with PHP.


      I can retrieve accurate records easily with:



      My problem is creating a new record. There doesn't seem to be any way to execute a script before a record is created. The problem is that the fields are validated using a global field. Since this global field is inaccurate (and I can't set it), the validation fails. How can I set this global field BEFORE the record is created so the validation passes?


      I've also wondered this for a while now... how can I get this global field to hold it's value as long as my session is open? (similar to how the client works)


      I am using Filemaker Server 10 Advanced with the latest PHP API.




        • 1. Re: PHP API and Global fields


          I have a similar problem: I want to use a global field to pass values from my script to the php frontent (like logical error messages). I 'am wondering if it is at all possible to use global ields in the php environment.

          • 2. Re: PHP API and Global fields

            Disclaimer: I'm an absolute PHP noob. 


            Are you using PHP prevalidation (validate() method)? This does not support validation by calculation, as the FMS CWP with PHP guide states on p. 41.


            If you do after-validation (let the database validate): There is the setField method, which however is derived from a record object (Chapter editing records in FMS CWP with PHP guide, p. 30). I'm not sure if you can take a random record object and use setField(name of global field, value) to update the global. But is this a global that is stored within a session and is different from session to session?


            But by browsing the FMS CWP guide for PHP and the PHP API reference, get the impression that global fields are not supported much (there is, although, a isGlobal() method).


            However, in XML/XSLT CWP they are, but you need to turn on database sessions so that the value of a global field is maintained between requests during a session. I see nothing similar for CWP with PHP.