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

HDISVU02.m

Go to the documentation of this file.
  1. HDISVU02 ;BPFO/JRP - STORE VUIDS FOR SET OF CODES;5/12/2005
  1. ;;1.0;HEALTH DATA & INFORMATICS;**1,2**;Feb 22, 2005
  1. ;
  1. VUIDL(TAG,ROUTINE) ;Instantiate VUIDs for set of code fields
  1. ; Input: TAG - Line tag under which VUID data has been placed
  1. ; ROUTINE - Routine line tag is in
  1. ; Leave blank if in this routine
  1. ;Output: 0 = Stop post-install (error)
  1. ; 1 = Continue with post-install
  1. ; Notes: Data lines must be in the format
  1. ; File~Field~Code~VUID~Status~EffectiveDateTime
  1. ; (Status and EffectiveDateTime must be in internal format)
  1. ; (Default value for Status is 0 - Inactive)
  1. ; (Default value for EffectiveDateTime is NOW)
  1. ; : Call assumes that all input (TAG & ROUTINE) is valid
  1. ; : Call assumes that data lines are valid
  1. ; (i.e. no missing/bad data)
  1. ; : The incoming status/date will not be stored in an existing
  1. ; entry for the VUID if the currently stored status is the
  1. ; same as the input status.
  1. ;
  1. N OFFSET,DATA,FILE,FIELD,IREF,VUID,STAT,STDT,DONE,RESULT,HDIMSG
  1. S ROUTINE=$G(ROUTINE)
  1. S RESULT=1
  1. S DONE=0
  1. F OFFSET=1:1 D Q:DONE
  1. .S DATA=$S(ROUTINE="":$T(@TAG+OFFSET),1:$T(@TAG+OFFSET^@ROUTINE))
  1. .S DATA=$P(DATA,";;",2)
  1. .I DATA="" S DONE=1 Q
  1. .S FILE=$P(DATA,"~",1)
  1. .S FIELD=$P(DATA,"~",2)
  1. .S IREF=$P(DATA,"~",3)
  1. .S VUID=$P(DATA,"~",4)
  1. .S STAT=$P(DATA,"~",5)
  1. .I STAT="" S STAT=0
  1. .S STDT=$P(DATA,"~",6)
  1. .I STDT="" S STDT=$$NOW^XLFDT()
  1. .I '$$STOREIT(FILE,FIELD,IREF,VUID,STAT,STDT) D
  1. ..S HDIMSG(1)="**"
  1. ..S HDIMSG(2)="** Unable to store VUID and/or status information for file"
  1. ..S HDIMSG(3)="** "_FILE_", field "_FIELD_", and internal value "_IREF
  1. ..S HDIMSG(4)="**"
  1. ..D MES^XPDUTL(.HDIMSG) K HDIMSG
  1. ..S RESULT=0
  1. Q RESULT
  1. ;
  1. STOREIT(FILE,FIELD,IREF,VUID,STAT,STDT) ;Store VUID info
  1. ; Input: FILE - File number
  1. ; FIELD - Field number
  1. ; IREF - Internal reference
  1. ; VUID - VUID
  1. ; STAT - Status
  1. ; 0 = Inacive (default) 1 = Active
  1. ; STDT - Status Date/Time (FileMan)
  1. ; (Defaults to NOW)
  1. ;Output: 1 = Success
  1. ; 0 = Failure
  1. ; Notes: Existance/validity of input assumed (internal call)
  1. ; : Call will automatically inactivate terms when appropriate
  1. ; : The input status/date will not be stored in an existing
  1. ; entry for the VUID if the currently stored status is the
  1. ; same as the input status. Success (1) will be returned.
  1. ;
  1. N MASTER,CURSTAT
  1. S STAT=+$G(STAT)
  1. S STDT=+$G(STDT)
  1. I 'STDT S STDT=$$NOW^XLFDT()
  1. ;Is VUID already on file
  1. S CURSTAT=$$GETSTAT^XTID(FILE,FIELD,IREF)
  1. ;Don't store new date for same status (return SUCCESS)
  1. I $P(CURSTAT,"^",1)=STAT Q 1
  1. ;Store VUID (also sets master entry flag, if appropriate)
  1. I '$$SETVUID^XTID(FILE,FIELD,IREF,VUID) Q 0
  1. ;Inactivate non-master entries
  1. I '$$GETMASTR^XTID(FILE,FIELD,IREF) D
  1. .S STAT=0
  1. .S STDT=$$NOW^XLFDT()
  1. ;Store status
  1. Q $$SETSTAT^XTID(FILE,FIELD,IREF,STAT,STDT)