0 Replies Latest reply on Feb 27, 2016 3:47 AM by tays01s

    runtime scripts

    tays01s

      Some of the scripts that work in FM advanced don't work in the RT. I'm permitting modification of all records in the RT and have checked that the script isn't ending on a restricted layout. The script involve creation of new records and move about appropriate layouts.

       

      1 such problem is the script below, though a similar script works fine. In the problem script requesting a new record causes the overwriting of the last record. Are there any common problems I should search for?

       

       

      Perform Script [ “Allow user abort” ]

      Set Error Capture [ On ]
      Freeze Window
      Go to Layout
      [ “Patient_U” (Patient) ]
      #Above was originally Patient_D but needs to be generic Set Variable [ $ioID; Value:Patient::Calc_n ]
      #Block repeat current date IOs
      If [ not IsEmpty (IO|Today::_CalcUUID) ]

      Show Custom Dialog [ Title: "Already an 'IO' for this date"; Message: "An 'IO' already exists for this date. Instead modify the IO that already exists. Note that deleting the IO that exists for this date will also delete the associated Feed list."; Default Button: “OK”, Commit: “Yes” ]

      Else
      If
      [ IsEmpty (Calc::_PatientuuID) ]

      Perform Script [ “New_Calc” ]

      End If

      Go to Object [ Object Name: "io" ]
      Go to Related Record [ From table: “IO”; Using layout: “IO” (IO) ] [ Show only related records ]

      If [ not IsEmpty (IO::_CalcUUID) ]

      Go to Record/Request/Page [ Last ]
      Set Variable [ $IO_old_n; Value:Get(RecordNumber) ]

      Duplicate Record/Request

      Else
      Go to Layout
      [ “IO” (IO) ]

      New Record/Request

      End If

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

      Set Field [ IO::_CalcUUID; $IOID ]

      #& to ensure 'mod_sum_old' starts with same value

      Set Variable [ $mod_sum_old; Value:Patient::mod_sum ]

      Set Field [ IO_n::mod_sum_old; $mod_sum_old ]

      Commit Records/Requests [ No dialog ]

      #New IO & number current IO to duplicate FeedsUsed

      Set Variable [ $feedlistID; Value:IO::__uuID ]

      Go to Record/Request/Page [ $IO_old_n ] [ No dialog ]

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

      #FeedUsed not empty?

      If [ not IsEmpty (FeedsUsed::_IOuuID) ]

      Loop

      Go to Record/Request/Page [ First ]

      Set Variable [ $feed; Value:FeedsUsed::_FeedsUUID ]

      Duplicate Record/Request

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

      Set Field [ FeedsUsed::_IOuuID; $feedlistID ]

      Set Field [ FeedsUsed::_FeedsUUID; $feed ]

      Omit Record

      Go to Record/Request/Page [ First ]

      Omit Record

      Exit Loop If [ Get(FoundCount)=0 ]

      End Loop

      Else

      Perform Script [ “New_FeedsUsed” ]

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

      Commit Records/Requests [ No dialog ]

      End If
      Go to Layout
      [ “Patient_U” (Patient) ]

      Perform Script [ “Select IO 2 1st row” ]

      End If