4 Replies Latest reply on Jul 11, 2016 3:52 AM by coherentkris

    Subscripts within Perform on Server Script

    drted

      Trying to figure out what happens if you place a

       

            Perform Script: AnyScript

       

      within a script that you sent to Server to be performed via PSOS?

       

      Will that subscript also be automatically performed on the server, or will the subscript pop back to the client, and be performed locally?  So really two questions:

       

      1) Will subscripts work within a script sent to server?

      and

      2) in order for that subscript to be continued on the server, need one use the "Perform Script On Server" command rather than simply "Perform Script"

       

      I have created scripts that usually are performed on server, but occasionally, I need them to run locally.  Mostly for testing/debugging.  So I use the option key to say "if option key down, then run locally, but if not, then PSOS".  But I'm not sure what happens to nested subscripts after this point?

       

      I have actually "solved" my current situation, by largely eliminating sub-scripts, and instead running the entire PSOS script as one long script.  This works.  But for sake of modularity, I'd prefer to have certain loops and routines separated back out into subscripts.  But doing so seems to massively slow down the operation.  Hence, I suspect the subscripts all revert to running locally.  Perhaps I could solve it by using subscripts, but always using the PSOS step instead of merely Perform Script.?  But this becomes difficult if I desire to optionally run the script locally.

       

      Thanks for any insight you might have here.

       

      Ted

        • 1. Re: Subscripts within Perform on Server Script
          coherentkris

          PSOS runs the script and any sub scripts in the PSOS session.

          • 2. Re: Subscripts within Perform on Server Script
            drted

            Thanks for the prompt reply!

             

            In order for sub scripts to be run within the single PSOS session, do they need to be evoked by PSOS, or can one use the simpler "Perform Script" call?  Thanks again...

             

             

            Taking it one step further...

            If a subscript performs a basic:

             

            Go to Layout [XYZ]

            ....

            ....

            ....

            Go to Layout [original layout]

             

            will the parent's original context be restored?  Will the subscript return to the same record on the original layout from where the sub-script was called?

             

            In general, just like PSOS looses global field context and global variable context, it seems that PSOS scripts need to be overtly "told" which layout, and which record of that layout to start on.  It seems that if you merely start on record 2 of layout ABC, when you invoke a PSOS script, you cannot assume you will still be on record 2 of layout ABC on the server.  It seems one must within the PSOS script overtly again declare:

             

            go to layout ABC

            enter find mode

            set field to 2

            perform find

            ....

            ....

            rest of script

             

             

            This seems necessary, to be sure the context of the PSOS script remains true?

             

            Again thanks...

            Ted

            • 3. Re: Subscripts within Perform on Server Script
              user19752

              PSOS runs on new thread on server, it starts with opening the file.

               

              PSOS is not server compatible, so you can't use PSOS in script already run on PSOS.

              • 4. Re: Subscripts within Perform on Server Script
                coherentkris

                As noted any script that runs PSOS runs in its own thread/session and will run the entire process that was started.

                The thread (scripted process and any sub scripts) runs 100% independently from any other threads which means it has its own context in the file.

                When the thread is finished it ceases to exist.

                The thread behaves as if it was another user on the hosted file.