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

VIAATRI.m

Go to the documentation of this file.
  1. VIAATRI ;ALB/CR - RTLS Triggers General Utility ;5/4/16 10:06am
  1. ;;1.0;RTLS;**3,6**;April 22, 2013;Build 1
  1. ;
  1. Q
  1. ; Engineering call to this routine covered by IA #6069
  1. ;
  1. ; ------- collect record changes for RTLS -------
  1. ; this tag is called from multiple fields in files #6914 and #6928
  1. ; to capture data changes as they happen, a record ID is added in
  1. ; file #6930 (PENDING RTLS EVENTS) for the queue process
  1. ;
  1. ; ============================================================
  1. WC(FILE,ENTRY) ; FILE = either #6914 or #6928, ENTRY = IEN of the record
  1. ;
  1. ; All the triggered fields in files #6914 and #6928 have been added
  1. ; the 'NOREINDEX' flag to prevent flooding file #6930 if re-indexing
  1. ; of any of the M X-Refs is attempted.
  1. ;
  1. I $G(FILE)=""!($G(ENTRY)="") Q
  1. N DA,DATA,DIC,DO,D0,DLAYGO,IEN,FDA,MATCH,X,Y
  1. N DEFSITE,SITE,SITEIEN,TMSTMP
  1. ; don't store the same record multiple times
  1. S MATCH=0
  1. S IEN="" F S IEN=$O(^VIAA(6930,IEN)) Q:IEN="" D Q:MATCH
  1. . S DATA=$G(^VIAA(6930,IEN,0))
  1. . I $P(DATA,U,2)=FILE,$P(DATA,U,3)=ENTRY S MATCH=1
  1. I MATCH Q
  1. ;
  1. S TMSTMP=$$NOW^XLFDT
  1. ; get station number for equipment or space
  1. I FILE=6914!(FILE=6928) S SITE=$P($G(^DIC(6910,1,0)),U,2)
  1. S DIC(0)="L",DLAYGO=6930,DIC="^VIAA(6930,",X=SITE
  1. D FILE^DICN
  1. Q:+Y<1 ;*6 don't run UPDATE^DIE if FILE^DICN failed.
  1. ; Refiring of the triggers allows process to complete, so file 6930 does get updated.
  1. S DA=+Y
  1. L +^VIAA(6930,DA):5 I '$T D EN^DDIOL("File is in use - try again later.","","!") Q
  1. S FDA(6930,DA_",",1)=FILE
  1. S FDA(6930,DA_",",2)=ENTRY
  1. S FDA(6930,DA_",",3)=TMSTMP
  1. D UPDATE^DIE(,"FDA")
  1. L -^VIAA(6930,DA)
  1. Q
  1. ;
  1. ; =============================================================
  1. DEL(COUNT) ; clean up file PENDING RTLS EVENTS after transmission to Mule
  1. ; called from VIAAQUE after transmission of a record
  1. N DA,DIK
  1. S DIK="^VIAA(6930,"
  1. S DA=COUNT D ^DIK
  1. Q
  1. ;