6 Replies Latest reply on Nov 11, 2010 4:12 PM by schnook

    Script Help

    schnook

      Title

      Script Help

      Post

      Hello all,

      Don't really know what i am doing with this but this is what i have got so far do you think it will work?

      I want it to find an overdue vessel from the ETR field 30min after the time stated in the ETR field.

      Install On Timer Script ["OVERDUE_VESSEL"; Interval: 1800]

      OVERDUE_VESSEL Script

      Enter Find Mode []

      Set Field [NEW RADIO LOG::ETR; "<" & Get(CurrentTime) + 300]

      Set Error Capture [On]

      Perform Find []

      And do you get this script to run in the File Options just under switch to layout by ticking that box?

      Regards

      schnook
       

        • 1. Re: Script Help
          philmodjunk

          You have two scripts there.

          If you specify the first script, (Not Overdue Vessel) in File Options, then this should start up automatically each time you open the file and the timer will perform the Overdue Vessel script every 30 minutes until the window is closed or a different Install On Timer Script step sets up a different timer for the window.

          • 2. Re: Script Help
            schnook

            Hello Phil

            Sorry but i don't under stand what you mean by "If you specify the first script, (Not Overdue Vessel) in File Options"

            In the install on timmer script it asks for the script that you want to run mine is called OVERDUE _VESSEL i was just showing how that script is written and wondering if it was ok

            OVERDUE_VESSEL

            Enter Find Mode []

            Set Field [NEW RADIO LOG::ETR; "<" & Get(CurrentTime) + 300]

            Set Error Capture [On]

            Perform Find []

            Regards

            schnook

             

            • 3. Re: Script Help
              philmodjunk

              You have a one line script, that you do not identify with a name: 

              Install On Timer Script ["OVERDUE_VESSEL"; Interval: 1800]

              This is the "first script" you should set to run with File Options or possibly a third script that runs Overdue Vessle immediately and then uses Install On Timer to setup the timer.

              As written, the Overdue Vessel script should find all records where ETR is less than the current time plus 300 seconds--that's a time that is 300 seconds in the future.

              I would think you'd want an expression that computes a time in the past, computed by subtracting from the current time.

              I also don't see anything in the script to exclude records where ETR meets your criteria, but the vessel has returned--that detail depends on how you log vessels back into port on their return.

              • 4. Re: Script Help
                schnook

                Hi Phil

                Thanks for the reply, sorry i just can't get my head around this one this is way over my head man, so ok would it work if i did something like what below.

                Script Name: FIND_OVERDUE_VESSEL

                Install On Timer Script ["OVERDUE_VESSEL"; Interval: 1800]

                Script Name:OVERDUE_VESSEL

                Enter Find Mode []

                Set Field [NEW RADIO LOG::ETR; "<" & Get(CurrentTime) + 300]

                Set Error Capture [On]

                Perform Find []

                I would think you'd want an expression that computes a time in the past, computed by subtracting from the current time.

                How would i do that?

                I also don't see anything in the script to exclude records where ETR meets your criteria, but the vessel has returned--that detail depends on how you log vessels back into port on their return.

                When a vessel log off a new record is created and our sign off field (S/O) is given the value of yes from a drop down value list.

                Please help this is really confusing me as how to do it wright.

                Regards

                schnook

                 

                • 5. Re: Script Help
                  philmodjunk

                  Set Field [NEW RADIO LOG::ETR; "<" & Get(CurrentTime) - 300]

                  Would compute a time 300 seconds prior to now. That's only 5 minutes, so I assume you'd want to subtract a larger time value.

                  To list all records where the vessel is at least 1 hour overdue, use

                  Set Field [NEW RADIO LOG::ETR; "<" & Get(CurrentTime) - 3600]

                  You might use this for your script:

                  Enter Find Mode []
                  Set Field [NEW RADIO LOG::ETR; "<" & Get(CurrentTime) - 3600]
                  New Record/Request
                  Set Field [NEW RADIO LOG::SignOffField ; "Yes" ]
                  Omit Record
                  Set Error Capture [On]
                  Perform Find []

                  • 6. Re: Script Help
                    schnook

                    Hi Phil

                    Thanks you very much will try that and let you know

                    Regards

                    schnook