Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: RORRP010

RORRP010.m

Go to the documentation of this file.
  1. RORRP010 ;HCIOFO/SG - RPC: TASK MANAGER ; 10/5/05 11:12am
  1. ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
  1. ;
  1. Q
  1. ;
  1. ;***** DELETES THE TASK
  1. ; RPC: [ROR TASK DELETE]
  1. ;
  1. ; .RESULTS Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; TASK Task number
  1. ;
  1. ; Return Values:
  1. ;
  1. ; A negative value of the first "^"-piece of the RESULTS(0) indicates
  1. ; an error (see the RPCSTK^RORERR procedure for more details).
  1. ;
  1. ; Otherwise, zero is returned.
  1. ;
  1. DELTASK(RESULTS,TASK) ;
  1. N RORERRDL K RESULTS
  1. D CLEAR^RORERR("DELTASK^RORRP010",1)
  1. S RESULTS=$$DEQUEUE^RORTSK(TASK,1)
  1. D:RESULTS<0 RPCSTK^RORERR(.RESULTS,RESULTS)
  1. Q
  1. ;
  1. ;***** SCHEDULES THE REPORT
  1. ; RPC: [ROR REPORT SCHEDULE]
  1. ;
  1. ; .RESULTS Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; RPTCODE Code of the report
  1. ;
  1. ; [REGIEN] Registry IEN (if $G(REGIEN)'>0 the task will not
  1. ; be associated with any particular registry).
  1. ;
  1. ; [ZTDTH] Date/time to start the task (FileMan). By default
  1. ; (if $G(ZDTH)'>0) the task will be scheduled to run
  1. ; immediately (see the $$CREATE^RORTSK for details).
  1. ;
  1. ; [SCHCODE] Rescheduling code for the task. By default (if
  1. ; $G(SCHCODE)=""), the task is executed once. See
  1. ; description of the $$SCH^XLFDT function for
  1. ; possible values of the parameter).
  1. ;
  1. ; [.PARAMS] Reference to a local variable that contains report
  1. ; parameters in XML format.
  1. ;
  1. ; Return Values:
  1. ;
  1. ; A negative value of the first "^"-piece of the RESULTS(0) indicates
  1. ; an error (see the RPCSTK^RORERR procedure for more details).
  1. ;
  1. ; Otherwise, the task descriptor is returned in the RESULTS array
  1. ; (see the TASKINFO^RORRP010 entry point for details).
  1. ;
  1. SCHEDREP(RESULTS,RPTCODE,REGIEN,ZTDTH,SCHCODE,PARAMS) ;
  1. N RORERRDL,RPINFO,TASK,TMP,TSKPRM
  1. N ZTCPU,ZTDESC,ZTIO,ZTKIL,ZTPRI,ZTSAVE,ZTSYNC,ZTUCI
  1. D CLEAR^RORERR("SCHEDREP^RORRP010",1)
  1. S REGIEN=+$G(REGIEN),SCHCODE=$G(SCHCODE)
  1. ;--- Get the report descriptor
  1. S RC=$$RPINFO^RORUTL08(RPTCODE,.RPINFO)
  1. I RC<0 D RPCSTK^RORERR(.RESULTS,RC) Q
  1. ;--- Parse the report parameters
  1. S RC=$$PARSEPRM^RORTSK13(.PARAMS,.TSKPRM)
  1. ;--- Create the task
  1. S TASK=$$CREATE^RORTSK(2,RPINFO(9),,REGIEN,RPTCODE,SCHCODE,.TSKPRM)
  1. I TASK<0 D RPCSTK^RORERR(.RESULTS,TASK) Q
  1. ;--- Get the status
  1. D TASKINFO(.RESULTS,TASK)
  1. Q
  1. ;
  1. ;***** RETURNS THE TASK INFORMATION
  1. ; RPC: [ROR TASK INFO]
  1. ;
  1. ; .RESULTS Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; TASK Task number
  1. ;
  1. ; Return Values:
  1. ;
  1. ; A negative value of the first "^"-piece of the RESULTS(0) indicates
  1. ; an error (see the RPCSTK^RORERR procedure for more details).
  1. ;
  1. ; Otherwise, the task descriptor is returned in the RESULTS array
  1. ; (see the $$TASKINFO^RORTSK02 function for more details).
  1. ;
  1. ; RESULTS(0) Result Descriptor
  1. ; ^1: 1
  1. ; ^2: Number of nodes that make a single
  1. ; task descriptor (TIN)
  1. ;
  1. ; RESULTS(1) Task Number
  1. ; RESULTS(2) Task Type (internal^external)
  1. ; RESULTS(3) Registry (IEN^Name)
  1. ; RESULTS(4) Report (Code^Name)
  1. ; RESULTS(5) Description
  1. ; RESULTS(6) Task Status (internal^external)
  1. ; RESULTS(7) Creation Time (internal)
  1. ; RESULTS(8) User (DUZ^Name)
  1. ; RESULTS(9) Completion Time (internal)
  1. ; RESULTS(10) Progress Percentage
  1. ; RESULTS(11) Scheduled to Run at (internal)
  1. ; RESULTS(12) Task Log IEN
  1. ; RESULTS(13) Job Number
  1. ;
  1. TASKINFO(RESULTS,TASK) ;
  1. N RC,RORERRDL
  1. D CLEAR^RORERR("TASKINFO^RORRP010",1)
  1. S RC=$$TASKINFO^RORTSK02(TASK,.RESULTS,"EI")
  1. I RC'<0 S RESULTS(0)="1^"_$$TIN^RORTSK02
  1. E D RPCSTK^RORERR(.RESULTS,RC)
  1. Q
  1. ;
  1. ;***** RETURNS A LIST OF USER'S TASKS
  1. ; RPC: [ROR TASK LIST]
  1. ;
  1. ; .RESULTS Reference to a local variable where the results
  1. ; are returned to.
  1. ;
  1. ; [REGIEN] Registry IEN (all registries by default)
  1. ; [TYPE] Task Type (all types by default)
  1. ; [USER] User IEN (DUZ by default)
  1. ;
  1. ; Return Values:
  1. ;
  1. ; A negative value of the first "^"-piece of the RESULTS(0) indicates
  1. ; an error (see the RPCSTK^RORERR procedure for more details).
  1. ;
  1. ; Otherwise, the task descriptors are returned in the RESULTS array
  1. ; (see the TASKINFO^RORRP010 entry point for details).
  1. ;
  1. ; @RESULTS@(0) Result Descriptor
  1. ; ^01: Number of task descriptors returned
  1. ; in the RESULTS array (NTSK)
  1. ; ^02: Number of nodes that make a single
  1. ; task descriptor (TIN)
  1. ;
  1. ; @RESULTS@(i) Value returned by the $$TASKINFO^RORTSK02
  1. ; function. You can calculate the subscript
  1. ; of the item TI (from 1 to TIN) of the task
  1. ; TN (from 1 to NTSK) using the following
  1. ; formula: i = (TN-1)*TIN+TI.
  1. ;
  1. ; For example, if number of nodes returned by the $$TASKINFO^RORTSK02
  1. ; function for each task is 13 and the RESULTS array contains
  1. ; information about 3 tasks, the following nodes will be defined:
  1. ;
  1. ; @RESULTS@(0) = "3^13"
  1. ;
  1. ; @RESULTS@(1) = Task Number 1
  1. ; @RESULTS@(2) = Task Type 1 (internal^external)
  1. ; ...
  1. ; @RESULTS@(13) = Job Number 1
  1. ;
  1. ; @RESULTS@(14) = Task Number 2
  1. ; @RESULTS@(15) = Task Type 2 (internal^external)
  1. ; ...
  1. ; @RESULTS@(26) = Job Number 2
  1. ;
  1. ; @RESULTS@(27) = Task Number 3
  1. ; @RESULTS@(28) = Task Type 3 (internal^external)
  1. ; ...
  1. ; @RESULTS@(39) = Job Number 3
  1. ;
  1. TASKLIST(RESULTS,REGIEN,TYPE,USER) ;
  1. N INFO,NTSK,RC,RORERRDL,TASK,TASKLIST,TIN
  1. D CLEAR^RORERR("TASKLIST^RORRP010",1)
  1. ;--- Initialize the variables
  1. K RESULTS S RESULTS=$$ALLOC^RORTMP()
  1. S TIN=$$TIN^RORTSK02
  1. ;--- Get the list of task numbers
  1. S RC=$$LIST^RORTSK02(.TASKLIST,$G(REGIEN),$G(TYPE),,,$G(USER))
  1. I RC<0 D RPCSTK^RORERR(.RESULTS,RC) Q
  1. ;--- Generate the output list
  1. S TASK="",NTSK=0
  1. F S TASK=$O(TASKLIST(TASK)) Q:TASK="" D
  1. . K INFO
  1. . S RC=$$TASKINFO^RORTSK02(TASK,.INFO,"EI",NTSK*TIN) Q:RC<0
  1. . M @RESULTS=INFO S NTSK=NTSK+1
  1. S @RESULTS@(0)=NTSK_U_TIN
  1. Q