4 Replies Latest reply on Jul 13, 2011 4:37 PM by albi2103

    Schedule script on FM v11 server and calculated field

    albi2103

      Title

      Schedule script on FM v11 server and calculated field

      Your post

      Hello,

      I'm trying to execute a script on the server side.

      Basically it create a new record with two calculated field at the creation.

      The value come from the same Table in two global field updated by a Perform script with the last Exchange rates of the day.

      It work well when I execute it manually in the table.

      When I execute it from the server it doesn't do the calculation of the field!

      Any idea?

      Thank you

      Alain

        • 1. Re: Schedule script on FM v11 server and calculated field
          philmodjunk

          "The value come from the same Table in two global field updated by a Perform script with the last Exchange rates of the day."

          Does this script get performed by your server scheduled script before creating the new record?

          Performing a script to change a global field from a client station does not produce a change to that field that will be retained when the file is closed on the client computer. That's a built in property for global fields when used in a shared database.

          The fix would be to set those global values with your schedule script first, then create the new record.

          Note: Changes to a global field made by the server will persist as this is change is being made on the host session. If you want these fields to be blank when a client first opens the database, have your script clear the fields before the script ends.

          • 2. Re: Schedule script on FM v11 server and calculated field
            albi2103

            Thank for your help.

            Yes the global fields are updated Before I create the new record.

            And the Global are updated as needed, no problem.

            The problem is when I want the field to be calculate at the creation of the record, let say the Date, with the data from the Global field.

            The same problem happened when I try to do it manually in the script like "Set field Date with the Global value" or with the script parameter I pass also.

            And yes the user have the rights to update any field.

            It works when I start the script locally but not when the script is Scheduled on the Server.

            It create the New Record, do the automatic calculation like Time stamp, Account name, but don't do the calculation or won't get the script parameter.

            The server doesn't work with Global? or $$field?

            I just change the way it works, I create the new record with the current day and do a relookup instead of a calculate and it works well.

            But I'm still wondering why it cannot update the field by calculate or by set field...

            • 3. Re: Schedule script on FM v11 server and calculated field
              philmodjunk

              Is the parameter passed via the script schedule?

              Is it a calculated expression?

              I learned the hard way that only literal values can be passed as a parameter directly from the server schedule. This only applies to the initial entry you make in the server schedule. Any scripts that pass parameters to other scripts should evaluate normally.

              • 4. Re: Schedule script on FM v11 server and calculated field
                albi2103

                Is the parameter passed via the script schedule? No, I load the parameter from the value I found from the first script, in fact as a Script Result.

                Is it a calculated expression? No, its just a date and a number using a Custom function.

                The value seems to be good when I try to pass the value thrue the Script result from the Script scheduled on the server.

                And If I store the value in the Table where I want them in a global field, values are there, but the end of the Scheduled Script doesn't work.

                I mean to Set FieldDate with the Global field date in the same table, executed from the server.

                It works fine when I execute it manually from FM Pro... Frown

                Anyway, the lookup is doing the job when I create the record. I get the related infos when I enter the date which is the current date.

                More simple and efficient!... Cool