7 Replies Latest reply on Mar 17, 2012 10:36 PM by BruceHerbach

    Server Side script / User Definition

    greber

      I have the following problem:

       

      Environment:

       

      Filemaker Server 11 advanced on Win Server 2008 R2.

       

      FileMaker Pro 11

       

      I have a simple testdatabase Test 1, where I want to get the Datapath on the server by running a server side script:

       

      The script contains a Get (Datapath) which assings this to Field 1.

       

      When I run this script on my local PC I get the expected result.

       

      When I run the same script as server side script, I do not get any result, an the log reports that the script has succesfully run.

       

      The Filemaker Admin User is a fantasy account with no relation as lcal user or Active Directory User. FMSAdmin.

      Question: Is it necessary, to run the script as an Active Directory User, so that I get the expected result.

       

      Other functions and script run without any problem, just importing .csv files always report a server script error 100. I would assume, that the Filemaker Server Account is not known to the windows Server, and therefore can not interact with the windows Files.

       

      Thank you for your help.

       

      Bernhard

        • 1. Re: Server Side script / User Definition
          BruceHerbach

          Hi Bernhard,

           

          I believe you are correct, this is user/system access issue.

           

          A couple of things you can do to test this.  First on the system console see if you can login with the FileMaker server account.  The one used when the script is run by the server.   If this fails, then this is the problem and you will need to work with the server/active directory admin to come up with a secure account to use.

           

          If you can login,  try opening the file in Advanced and step through the script and see where it fails.

           

          Last option is to add a debug table and have the script create a record that stores the script step and result of each step.  This will let you see what step failed.

           

          HTH

          Bruce

          • 2. Re: Server Side script / User Definition
            greber

            Hi Bruce,

             

            I resolved the problem:

            - I changed the script. Before I used global fields, which where updated, but only visible after closing and reopening the test 1 db. Now I use regular text fields and use the formula get(Datpathlist) and I see now the the path c:\filemaker ..... \usd.csv.

            - I copy this data path into the import step in the script

            Now I run the script again, and the data is imported successfully.

             

            So the server script works, and I know now, where I have to put files to import.

             

            Thank you for your help.

             

            Bernhard

            • 3. Re: Server Side script / User Definition
              BruceHerbach

              Bernhard,

               

              Happy to hear you worked this out.  The issue/beauty of global fields is that they only get a permenanent value when set in a local session.  When set on the server,  they revert back to the original/local value next time the file is opened.  This is great when you want each user attached to a server to have there own value in the field.  Not so great when trying to debug something like this,  since the field is back to its previous value the next time you open the file and you can't see what another user has in the field. 

               

              Bruce

              • 4. Re: Server Side script / User Definition
                greber

                Hello Bruce,

                 

                a steep learning curve. I was not aware, that the global field is not permanent, but now I will never forget.

                 

                Bernhard

                • 5. Re: Server Side script / User Definition
                  BruceHerbach

                  Hi Bernhard,

                   

                  Just to be clear,  if 5 users are using a file with a global field,  when they first open the file,  the Global field will have the last value set in it by a local session.  So they all have the same starting place.  After that any changes made to the value of the field will only be seen by the user that made the change and not by any of the other users.

                   

                  At this point,  I have a development server,  and have all databases I'm working with stored on the server.  So to set an initial value for Global fields,  I have the startup script for the file set the desired value. There are a number of ways to retain/set the values.  If you are interested let me know and I can give you some methods for doing this.

                   

                  HTH

                  Bruce

                  • 6. Re: Server Side script / User Definition
                    dchabot

                    Hi Bruce,

                    I'd like to know some ways to retain/set the values?

                     

                    Thanks

                    Deb C.

                    • 7. Re: Server Side script / User Definition
                      BruceHerbach

                      Hi Deb,

                       

                      Probably the easiest way is to put a set field step in the file startup script. 

                       

                      If there are a number of these and I want the user to be able to permenantly change the values, I add a table to hold default values.  Typically this table has only one record with one field for each global field.  The startup script sets the global fields from the corresponding fields in this record.

                       

                      Then add scripting to update the stored values. 

                       

                      If you have more questions about doing this please post them.

                      HTH

                      Bruce