5 Replies Latest reply on Oct 14, 2015 5:48 AM by erolst

    Portal row reset by script

    tays01s

      I have a script that resets the portal row to the latest record. I don't want this and the portal does not have 'reset' checked. Also there is nothing obvious within the script causing the reset. I have another, similar script on a portal button that doesn't do this. However, the differences in script haven't given a clue to why one 'resets' and the other doesn't.

       

      Are there any clues I could look for in the script?

        • 1. Re: Portal row reset by script
          Extensitech

          tays01s wrote:

           

          I have a script that resets the portal row to the latest record.

          Could you clarify? Not sure what this means. Do you mean it scrolls to the end of the portal?

           

          Could we maybe see a screen shot of the script?

           

          Chris Cain

          Extensitech

          • 2. Re: Portal row reset by script
            tays01s

            I've got records sorted into reverse date order, ie. latest at top. I might select 5th down. When I activate the script below from a portal row button, the calculations etc. are correctly done for that 5th record, but the portal resets with the latest record showing at the top of the portal. This often means the selected portal is off-screen; confusing to the user.

             

             

            Perform Script [ “Allow user abort” ]

            Freeze Window

            If [ IsEmpty (Nut_calcs 2::_IOuuID) ]

            Set Field [ Patient::IO_n; IO 2::__uuID ]

            Set Variable [ $nutcalc_ioID; Value:Patient::IO_n ]

            Go to Layout [ “Nut_calcs” (Nut_calcs) ]

            Loop

            Exit Loop If [ Let($i = $i +1;$i > 3) ]

            New Record/Request

            Set Field [ Nut_calcs::__uuID; Get(UUID) ]

            Set Field [ Nut_calcs::_IOuuID; $nutcalc_ioID ]

            Set Field [ Nut_calcs::_Nut_eqsID; $i ]

            End Loop

            Replace Field Contents [ Nut_calcs::Nut; Replace with calculation: Nut_eqs::Nut ] [ No dialog ]

            Else

            Go to Related Record [ From table: “Nut_calcs 2”; Using layout: “Nut_calcs 2” (Nut_calcs 2) ] [ Show only related records ]

            Replace Field Contents [ Nut_calcs 2::Rx; Replace with calculation: Evaluate(Nut_eqs 2::Rx) ] [ No dialog ]

            End If

            Go to Layout [ “Patient_L” (Patient) ]

            • 3. Re: Portal row reset by script
              erolst

              A portal is reset when you leave the layout.

               

              Either capture the active portal row ands return to it (or capture the primary ID of that row if the order could change, then return to it via a loop), or perform the script in a new window.

              • 4. Re: Portal row reset by script
                tays01s

                I hadn't known about the reset on leaving the layout, thanks.

                 

                New window: Is the principle to script 'new window > 'do stuff' > 'close window' so that you can generate new values that will appear on the original window but you won't have changed position of records in portals etc.?

                 

                I've tried setting a variable to get (activeportalrownumber) once the portal row was selected in the script then after the loop 'go to portal > variable, but still found that it reset to the latest portal row.

                • 5. Re: Portal row reset by script
                  erolst

                  tays01s wrote:

                  New window: Is the principle to script 'new window > 'do stuff' > 'close window' so that you can generate new values that will appear on the original window but you won't have changed position of records in portals etc.?

                   

                  Yes, that's the idea.