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

ECPRVDR.m

Go to the documentation of this file.
  1. ECPRVDR ;ALB/DAN - Event Capture Providers ;11/7/16 15:29
  1. ;;2.0;EVENT CAPTURE;**134**;8 May 96;Build 12
  1. ;
  1. FILE ;Used by RPC broker to file users into file #722
  1. ; Variables passed in
  1. ; ECD0...n -IEN of user to be added to file #722
  1. ;
  1. ; Varibles returned
  1. ; ^TMP($J,"ECMSG",1)=Success or failure of filing records
  1. ;
  1. N ECI,ECX,ECPRV,NODE,ECFDA,IEN,ECERR,ERR,RES
  1. S ERR=0
  1. F ECI=0:1 S ECX="ECD"_ECI Q:'$D(@ECX)!(ERR) I @ECX'="" D
  1. .D CHK^DIE(722,.01,,"`"_@ECX,.RES) I $G(RES)="^" S ERR=1,^TMP($J,"ECMSG",1)="0^IEN of user doesn't exist in file 200" Q
  1. .S ECPRV(@ECX)="" ;Put IENs in array
  1. I ERR Q ;Stop processing if a bad IEN has been passed in
  1. ;Delete all existing entries in file 722 before putting in new list
  1. S NODE=$G(^EC(722,0)) I NODE="" S ^TMP($J,"ECMSG",1)="0^File 722 doesn't exist" Q
  1. K ^EC(722) ;remove all entries and x-refs
  1. S ^EC(722,0)=NODE,$P(^EC(722,0),U,3,99)="" ;reset 0 node and remove total records and last record used information
  1. ;Populate file with list of entries
  1. S IEN=0 F S IEN=$O(ECPRV(IEN)) Q:'+IEN!(ERR) D
  1. .S ECFDA(722,"+1,",.01)=IEN
  1. .D UPDATE^DIE("","ECFDA","","ECERR") ;Add entry to file 722
  1. .I $D(ECERR) S ^TMP($J,"ECMSG",1)="0^Unable to file IEN "_IEN_" into file" S ERR=1
  1. I 'ERR S ^TMP($J,"ECMSG",1)="1^File successfully updated"
  1. Q
  1. ;
  1. LIST ;Return list of entries in file 722
  1. N I,NAM,IEN
  1. S I=0,NAME=""
  1. F S NAME=$O(^EC(722,"AC",NAME)) Q:NAME="" S IEN=0 F S IEN=$O(^EC(722,"AC",NAME,IEN)) Q:'+IEN D
  1. .I '$$ACTIVE^XUSER(IEN) Q ;Don't include inactive users on the list.
  1. .S I=I+1,^TMP($J,"ECFIND",I)=NAME_"^"_IEN
  1. Q