- HDISVF05 ;ALB/RMO - 7115.6 File Utilities/API Cont.; 1/11/05@2:37:00
- ;;1.0;HEALTH DATA & INFORMATICS;;Feb 22, 2005
- ;
- ;---- Begin HDIS File/Field file (#7115.6) API(s) ----
- ;
- ADDFFNM(HDISFILN,HDISFLDN,HDISFIEN,HDISERRM) ;Add a New File/Field Entry
- ; Input -- HDISFILN File Number
- ; HDISFLDN Field Number (Optional- Default .01)
- ; Output -- 1=Successful and 0=Failure
- ; If Successful:
- ; HDISFIEN HDIS File/Field file IEN
- ; If Failure:
- ; HDISERRM Error Message (Optional)
- N HDISFDA,HDISFFNM,HDISIEN,HDISMSG,HDISOKF
- ;Initialize output
- S (HDISFIEN,HDISERRM)=""
- ;Check for missing variable, exit if not defined
- I $G(HDISFILN)'>0 D G ADDFFNMQ
- . S HDISERRM="Required Variable Missing."
- ;Set Field Number to default of .01, if needed
- S HDISFLDN=$S('$D(HDISFLDN):.01,1:HDISFLDN)
- ;Set File/Field Name to file#~field# (i.e. 10.3~.01)
- S HDISFFNM=HDISFILN_"~"_HDISFLDN
- ;Check for existing File Number and Field Number, return error and exit if it exists
- I $D(^HDIS(7115.6,"AFIL",HDISFILN,HDISFLDN)) D G ADDFFNMQ
- . S HDISERRM="File Number and Field Number already exists."
- ;Set array for File/Field Name, File Number and Field Number
- S HDISFDA(7115.6,"+1,",.01)=$G(HDISFFNM)
- S HDISFDA(7115.6,"+1,",.02)=$G(HDISFILN)
- S HDISFDA(7115.6,"+1,",.04)=$G(HDISFLDN)
- D UPDATE^DIE("E","HDISFDA","HDISIEN","HDISMSG")
- ;Check for error
- I $D(HDISMSG("DIERR")) D
- . S HDISERRM=$G(HDISMSG("DIERR",1,"TEXT",1))
- ELSE D
- . S HDISFIEN=+$G(HDISIEN(1))
- . S HDISOKF=1
- D CLEAN^DILF
- ADDFFNMQ Q +$G(HDISOKF)
- ;
- GETIEN(HDISFILN,HDISFLDN,HDISFIEN) ;Get IEN for a File/Field by File Number and Field Number
- ; Input -- HDISFILN File Number
- ; HDISFLDN Field Number (Optional- Default .01)
- ; Output -- 1=Successful and 0=Failure
- ; If Successful:
- ; HDISFIEN HDIS File/Field file IEN
- ;Initialize output
- S HDISFIEN=""
- ;Check for missing variable, exit if not defined
- I $G(HDISFILN)'>0 G GETIENQ
- ;Set Field Number to .01 default if needed
- S HDISFLDN=$S('$D(HDISFLDN):.01,1:HDISFLDN)
- ;Check for entry by File Number and Field Number
- S HDISFIEN=$O(^HDIS(7115.6,"AFIL",HDISFILN,HDISFLDN,0))
- GETIENQ Q +$S($G(HDISFIEN)>0:1,1:0)
- ;
- GETFF(HDISFIEN,HDISFILN,HDISFLDN) ;Get File Number and Field Number for a File/Field by IEN
- ; Input -- HDISFIEN HDIS File/Field file IEN
- ; Output -- 1=Successful and 0=Failure
- ; If Successful:
- ; HDISFILN File Number
- ; HDISFLDN Field Number
- N HDIS0
- ;Initialize output
- S (HDISFILN,HDISFLDN)=""
- ;Check for missing variable, exit if not defined
- I $G(HDISFIEN)'>0 G GETFFQ
- ;Check for File Number and Field Number by IEN
- I $D(^HDIS(7115.6,HDISFIEN,0)) S HDIS0=$G(^(0)) D
- . S HDISFILN=$P(HDIS0,"^",2)
- . S HDISFLDN=$P(HDIS0,"^",4)
- GETFFQ Q +$S($G(HDISFILN)'=""&($G(HDISFLDN)'=""):1,1:0)
- ;
- ;---- End HDIS File/Field file (#7115.6) API(s) ----
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHDISVF05 2969 printed Jan 18, 2025@02:58:01 Page 2
- HDISVF05 ;ALB/RMO - 7115.6 File Utilities/API Cont.; 1/11/05@2:37:00
- +1 ;;1.0;HEALTH DATA & INFORMATICS;;Feb 22, 2005
- +2 ;
- +3 ;---- Begin HDIS File/Field file (#7115.6) API(s) ----
- +4 ;
- ADDFFNM(HDISFILN,HDISFLDN,HDISFIEN,HDISERRM) ;Add a New File/Field Entry
- +1 ; Input -- HDISFILN File Number
- +2 ; HDISFLDN Field Number (Optional- Default .01)
- +3 ; Output -- 1=Successful and 0=Failure
- +4 ; If Successful:
- +5 ; HDISFIEN HDIS File/Field file IEN
- +6 ; If Failure:
- +7 ; HDISERRM Error Message (Optional)
- +8 NEW HDISFDA,HDISFFNM,HDISIEN,HDISMSG,HDISOKF
- +9 ;Initialize output
- +10 SET (HDISFIEN,HDISERRM)=""
- +11 ;Check for missing variable, exit if not defined
- +12 IF $GET(HDISFILN)'>0
- Begin DoDot:1
- +13 SET HDISERRM="Required Variable Missing."
- End DoDot:1
- GOTO ADDFFNMQ
- +14 ;Set Field Number to default of .01, if needed
- +15 SET HDISFLDN=$SELECT('$DATA(HDISFLDN):.01,1:HDISFLDN)
- +16 ;Set File/Field Name to file#~field# (i.e. 10.3~.01)
- +17 SET HDISFFNM=HDISFILN_"~"_HDISFLDN
- +18 ;Check for existing File Number and Field Number, return error and exit if it exists
- +19 IF $DATA(^HDIS(7115.6,"AFIL",HDISFILN,HDISFLDN))
- Begin DoDot:1
- +20 SET HDISERRM="File Number and Field Number already exists."
- End DoDot:1
- GOTO ADDFFNMQ
- +21 ;Set array for File/Field Name, File Number and Field Number
- +22 SET HDISFDA(7115.6,"+1,",.01)=$GET(HDISFFNM)
- +23 SET HDISFDA(7115.6,"+1,",.02)=$GET(HDISFILN)
- +24 SET HDISFDA(7115.6,"+1,",.04)=$GET(HDISFLDN)
- +25 DO UPDATE^DIE("E","HDISFDA","HDISIEN","HDISMSG")
- +26 ;Check for error
- +27 IF $DATA(HDISMSG("DIERR"))
- Begin DoDot:1
- +28 SET HDISERRM=$GET(HDISMSG("DIERR",1,"TEXT",1))
- End DoDot:1
- +29 IF '$TEST
- Begin DoDot:1
- +30 SET HDISFIEN=+$GET(HDISIEN(1))
- +31 SET HDISOKF=1
- End DoDot:1
- +32 DO CLEAN^DILF
- ADDFFNMQ QUIT +$GET(HDISOKF)
- +1 ;
- GETIEN(HDISFILN,HDISFLDN,HDISFIEN) ;Get IEN for a File/Field by File Number and Field Number
- +1 ; Input -- HDISFILN File Number
- +2 ; HDISFLDN Field Number (Optional- Default .01)
- +3 ; Output -- 1=Successful and 0=Failure
- +4 ; If Successful:
- +5 ; HDISFIEN HDIS File/Field file IEN
- +6 ;Initialize output
- +7 SET HDISFIEN=""
- +8 ;Check for missing variable, exit if not defined
- +9 IF $GET(HDISFILN)'>0
- GOTO GETIENQ
- +10 ;Set Field Number to .01 default if needed
- +11 SET HDISFLDN=$SELECT('$DATA(HDISFLDN):.01,1:HDISFLDN)
- +12 ;Check for entry by File Number and Field Number
- +13 SET HDISFIEN=$ORDER(^HDIS(7115.6,"AFIL",HDISFILN,HDISFLDN,0))
- GETIENQ QUIT +$SELECT($GET(HDISFIEN)>0:1,1:0)
- +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
- +2 ; Output -- 1=Successful and 0=Failure
- +3 ; If Successful:
- +4 ; HDISFILN File Number
- +5 ; HDISFLDN Field Number
- +6 NEW HDIS0
- +7 ;Initialize output
- +8 SET (HDISFILN,HDISFLDN)=""
- +9 ;Check for missing variable, exit if not defined
- +10 IF $GET(HDISFIEN)'>0
- GOTO GETFFQ
- +11 ;Check for File Number and Field Number by IEN
- +12 IF $DATA(^HDIS(7115.6,HDISFIEN,0))
- SET HDIS0=$GET(^(0))
- Begin DoDot:1
- +13 SET HDISFILN=$PIECE(HDIS0,"^",2)
- +14 SET HDISFLDN=$PIECE(HDIS0,"^",4)
- End DoDot:1
- GETFFQ QUIT +$SELECT($GET(HDISFILN)'=""&($GET(HDISFLDN)'=""):1,1:0)
- +1 ;
- +2 ;---- End HDIS File/Field file (#7115.6) API(s) ----