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

HDISVF05.m

Go to the documentation of this file.
  1. HDISVF05 ;ALB/RMO - 7115.6 File Utilities/API Cont.; 1/11/05@2:37:00
  1. ;;1.0;HEALTH DATA & INFORMATICS;;Feb 22, 2005
  1. ;
  1. ;---- Begin HDIS File/Field file (#7115.6) API(s) ----
  1. ;
  1. ADDFFNM(HDISFILN,HDISFLDN,HDISFIEN,HDISERRM) ;Add a New File/Field Entry
  1. ; Input -- HDISFILN File Number
  1. ; HDISFLDN Field Number (Optional- Default .01)
  1. ; Output -- 1=Successful and 0=Failure
  1. ; If Successful:
  1. ; HDISFIEN HDIS File/Field file IEN
  1. ; If Failure:
  1. ; HDISERRM Error Message (Optional)
  1. N HDISFDA,HDISFFNM,HDISIEN,HDISMSG,HDISOKF
  1. ;Initialize output
  1. S (HDISFIEN,HDISERRM)=""
  1. ;Check for missing variable, exit if not defined
  1. I $G(HDISFILN)'>0 D G ADDFFNMQ
  1. . S HDISERRM="Required Variable Missing."
  1. ;Set Field Number to default of .01, if needed
  1. S HDISFLDN=$S('$D(HDISFLDN):.01,1:HDISFLDN)
  1. ;Set File/Field Name to file#~field# (i.e. 10.3~.01)
  1. S HDISFFNM=HDISFILN_"~"_HDISFLDN
  1. ;Check for existing File Number and Field Number, return error and exit if it exists
  1. I $D(^HDIS(7115.6,"AFIL",HDISFILN,HDISFLDN)) D G ADDFFNMQ
  1. . S HDISERRM="File Number and Field Number already exists."
  1. ;Set array for File/Field Name, File Number and Field Number
  1. S HDISFDA(7115.6,"+1,",.01)=$G(HDISFFNM)
  1. S HDISFDA(7115.6,"+1,",.02)=$G(HDISFILN)
  1. S HDISFDA(7115.6,"+1,",.04)=$G(HDISFLDN)
  1. D UPDATE^DIE("E","HDISFDA","HDISIEN","HDISMSG")
  1. ;Check for error
  1. I $D(HDISMSG("DIERR")) D
  1. . S HDISERRM=$G(HDISMSG("DIERR",1,"TEXT",1))
  1. ELSE D
  1. . S HDISFIEN=+$G(HDISIEN(1))
  1. . S HDISOKF=1
  1. D CLEAN^DILF
  1. ADDFFNMQ Q +$G(HDISOKF)
  1. ;
  1. GETIEN(HDISFILN,HDISFLDN,HDISFIEN) ;Get IEN for a File/Field by File Number and Field Number
  1. ; Input -- HDISFILN File Number
  1. ; HDISFLDN Field Number (Optional- Default .01)
  1. ; Output -- 1=Successful and 0=Failure
  1. ; If Successful:
  1. ; HDISFIEN HDIS File/Field file IEN
  1. ;Initialize output
  1. S HDISFIEN=""
  1. ;Check for missing variable, exit if not defined
  1. I $G(HDISFILN)'>0 G GETIENQ
  1. ;Set Field Number to .01 default if needed
  1. S HDISFLDN=$S('$D(HDISFLDN):.01,1:HDISFLDN)
  1. ;Check for entry by File Number and Field Number
  1. S HDISFIEN=$O(^HDIS(7115.6,"AFIL",HDISFILN,HDISFLDN,0))
  1. GETIENQ Q +$S($G(HDISFIEN)>0:1,1:0)
  1. ;
  1. GETFF(HDISFIEN,HDISFILN,HDISFLDN) ;Get File Number and Field Number for a File/Field by IEN
  1. ; Input -- HDISFIEN HDIS File/Field file IEN
  1. ; Output -- 1=Successful and 0=Failure
  1. ; If Successful:
  1. ; HDISFILN File Number
  1. ; HDISFLDN Field Number
  1. N HDIS0
  1. ;Initialize output
  1. S (HDISFILN,HDISFLDN)=""
  1. ;Check for missing variable, exit if not defined
  1. I $G(HDISFIEN)'>0 G GETFFQ
  1. ;Check for File Number and Field Number by IEN
  1. I $D(^HDIS(7115.6,HDISFIEN,0)) S HDIS0=$G(^(0)) D
  1. . S HDISFILN=$P(HDIS0,"^",2)
  1. . S HDISFLDN=$P(HDIS0,"^",4)
  1. GETFFQ Q +$S($G(HDISFILN)'=""&($G(HDISFLDN)'=""):1,1:0)
  1. ;
  1. ;---- End HDIS File/Field file (#7115.6) API(s) ----