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

SDESCONTACTS.m

Go to the documentation of this file.
SDESCONTACTS ;ALB/BWF,JAS - VISTA SCHEDULING CONTACT RPCS ;AUG 28, 2024
 ;;5.3;Scheduling;**835,837,845,851,887**;Aug 13, 1993;Build 7
 ;;Per VHA Directive 6402, this routine should not be modified
 Q
 ; RPC: SDES CONTACT NEW
 ; INPUT:
 ;CONTACT("CLINIC")=CLINIC IEN
 ;- Clinic IEN from the HOSPITAL LOCATION FILE (#44
 ;CONTACT("COMMENTS")=COMMENTS
 ;- Free text comments (1-80 characters)
 ;CONTACT("CONTACTIEN")=CONTACT IEN
 ;- IEN of the main contact entry in the SDEC CONTACT file (#409.86)
 ;CONTACT("CONTACTTYPE")=CONTACT TYPE
 ;- Contact Type (C - Call, L - Letter, E - Email, T - Text, S - Secure messaging)
 ;CONTACT("DFN")=PATIENT DFN
 ;- Pointer to the PATIENT file (#2)
 ;CONTACT("DTTMENTERED")=DATE/TIME ENTERED (ISO FORMAT)
 ;- ISO Date/Time
 ;CONTACT("DTTMOFCONTACT")=DATE/TIME OF CONTACT (ISO FORMAT)
 ;- ISO Date/Time
 ;CONTACT("LEFTMESSAGE")=0 for no, 1 for yes
 ;CONTACT("PREFDATE")=PREFERRED DATE (ISO FORMAT)
 ;- ISO Date
 ;CONTACT("REQTYPE")=REQUEST TYPE
 ;- Request Type (A - APPT, R - RECALL, C - CONSULT)
 ;CONTACT("REQUESTIEN")=REQUEST IEN
 ;- Request IEN (Variable pointer) based on the request type
 ;  A - SDEC APPT REQUEST (#409.85)
 ;  C - REQUEST/CONSULTATION file (#123)
 ;  R - RECALL REQUEST file (#403.5)
 ;
ADDUPD(RESULT,CONTACT) ;
 N ERRORS,DFN,CLINIC,PREFDATE,REQTYPE,DTTMOFCONTACT,CONTACTTYPE,COMMENTS,DTTMENTERED,REQUESTIEN,NEWCONTACT
 N NEWIEN,SDREQPTR40986,REQTYPE40985,FILERR,FDA,NEWCONTIEN,SUBIENS,CONTACTIEN,SEQUENCE,LEFTMSG,NEWCONTATTMTIEN
 S DFN=$G(CONTACT("DFN"))
 S CLINIC=$G(CONTACT("CLINIC"))
 S PREFDATE=""
 S REQTYPE=$G(CONTACT("REQTYPE"))
 S DTTMOFCONTACT=$G(CONTACT("DTTMOFCONTACT"))
 S CONTACTTYPE=$G(CONTACT("CONTACTTYPE"))
 S COMMENTS=$G(CONTACT("COMMENTS"))
 S DTTMENTERED=$G(CONTACT("DTTMENTERED"))
 S REQUESTIEN=$G(CONTACT("REQUESTIEN"))
 S LEFTMSG=$G(CONTACT("LEFTMESSAGE"))
 I LEFTMSG="" S LEFTMSG=0
 D VALIDATEDFN^SDESINPUTVALUTL(.ERRORS,DFN)
 I CLINIC'="" D VALIDATECLINIC(.ERRORS,CLINIC)
 I $D(ERRORS) S ERRORS("Contact",1)="" D BUILDJSON^SDESBUILDJSON(.RESULT,.ERRORS) Q
 D VALREQTYPE(.ERRORS,REQTYPE,"^R^A^RTC^C^P^V^")
 I $G(LEFTMSG)'="" D VALLEFTMSG(.ERRORS,LEFTMSG)
 S DTTMOFCONTACT=$$VALDATE2^SDESVALUTIL(.ERRORS,DTTMOFCONTACT,CLINIC,389,390)
 ; validate text input based on field definition
 D VALTEXTINPUT(.ERRORS,COMMENTS,409.863,2,1)
 S DTTMENTERED=$$VALDATE2^SDESVALUTIL(.ERRORS,DTTMENTERED,CLINIC,387,388)
 I $D(ERRORS) S ERRORS("Contact",1)="" D BUILDJSON^SDESBUILDJSON(.RESULT,.ERRORS) Q
 D VALREQIEN(.ERRORS,REQUESTIEN,REQTYPE)
 D VALSETOFCODES(.ERRORS,CONTACTTYPE,409.863,1,"Contact Type")
 S CONTACTIEN=$$GETCONTIEN(.ERRORS,REQUESTIEN,REQTYPE)
 I $D(ERRORS) S ERRORS("Contact",1)="" D BUILDJSON^SDESBUILDJSON(.RESULT,.ERRORS) Q
 I REQUESTIEN D
 .S SDREQPTR40986=""
 .I (REQTYPE="A")!(REQTYPE="RTC")!(REQTYPE="V") D
 ..Q:$$GET1^DIQ(409.85,REQUESTIEN,.01,"I")'=DFN
 ..S REQTYPE40985=$$GET1^DIQ(409.85,REQUESTIEN,4,"I")
 ..I REQTYPE40985'="APPT",REQTYPE40985'="RTC",REQTYPE40985'="VETERAN" Q
 ..S SDREQPTR40986=REQUESTIEN_";"_"SDEC(409.85,"
 ..S PREFDATE=$$GET1^DIQ(409.85,REQUESTIEN,22,"I")
 .Q:SDREQPTR40986'=""
 .I REQTYPE="C"!(REQTYPE="P") D
 ..Q:$$GET1^DIQ(123,REQUESTIEN,.02,"I")'=DFN
 ..Q:$$GET1^DIQ(123,REQUESTIEN,13,"I")'=REQTYPE
 ..Q:CLINIC'=""&(CLINIC'=$$GET1^DIQ(123,REQUESTIEN,.04,"I"))
 ..S SDREQPTR40986=REQUESTIEN_";"_"GMR(123,"
 ..I $D(^SDEC(409.87,"B",REQUESTIEN)) S PREFDATE=$$GETPID^SDECCONSJSON(REQUESTIEN)
 ..I '$D(^SDEC(409.87,"B",REQUESTIEN))!(PREFDATE="") S PREFDATE=$$GET1^DIQ(123,REQUESTIEN,17,"I")
 .Q:SDREQPTR40986'=""
 .I REQTYPE="R" D
 ..Q:$$GET1^DIQ(403.5,REQUESTIEN,.01,"I")'=DFN
 ..I CLINIC'="",$$GET1^DIQ(403.5,REQUESTIEN,4.5,"I")'=CLINIC Q
 ..S SDREQPTR40986=REQUESTIEN_";"_"SD(403.5,"
 ..S PREFDATE=$$GET1^DIQ(403.5,REQUESTIEN,5,"I")
 I $G(SDREQPTR40986)="" D  Q
 .D ERRLOG^SDESJSON(.ERRORS,394)
 .S ERRORS("Contact",1)=""
 .D BUILDJSON^SDESBUILDJSON(.RESULT,.ERRORS)
 I $G(PREFDATE)="" D
 .D ERRLOG^SDESJSON(.ERRORS,408)
 I $D(ERRORS) D  Q
 .S ERRORS("Contact",1)=""
 .D BUILDJSON^SDESBUILDJSON(.RESULT,.ERRORS)
 I 'CONTACTIEN D
 .D BLDNEWCONT(.FDA,"+1,",DFN,CLINIC,PREFDATE,REQTYPE,SDREQPTR40986)
 .S SUBIENS="+2,+1,"
 .D BLDNEWATTMPT(.FDA,SUBIENS,DTTMOFCONTACT,CONTACTTYPE,COMMENTS,DUZ,DTTMENTERED,LEFTMSG,1)
 ; if there is already a contactien, only build the Date/Time of contact subfile (#409.863) for filing
 I CONTACTIEN D
 .S SUBIENS="+1,"_CONTACTIEN_","
 .S SEQUENCE=$O(^SDEC(409.86,CONTACTIEN,1,9999),-1)+1
 .D BLDNEWATTMPT(.FDA,SUBIENS,DTTMOFCONTACT,CONTACTTYPE,COMMENTS,DUZ,DTTMENTERED,LEFTMSG,SEQUENCE)
 D UPDATE^DIE(,"FDA","NEWIEN","FILERR") K FDA
 I $D(FILERR) D  Q
 .D ERRLOG^SDESJSON(.ERRORS,52,$G(FILERR("DIERR",1,"TEXT",1)))
 .S ERRORS("Contact",1)=""
 .D BUILDJSON^SDESBUILDJSON(.RESULT,.ERRORS)
 I CONTACTIEN D
 .S NEWCONTATTMTIEN=$G(NEWIEN(1))
 I 'CONTACTIEN D
 .S CONTACTIEN=$G(NEWIEN(1))
 .S NEWCONTATTMTIEN=$G(NEWIEN(2))
 ; Update the preferred date/PID date if it is different than the request pid date
 I PREFDATE'=$$GET1^DIQ(409.68,CONTACTIEN,2,"I") D
 .S FDA(409.68,CONTACTIEN_",",2)=PREFDATE D FILE^DIE(,"FDA") K FDA
 D BLDCONTACT(.NEWCONTACT,CONTACTIEN,CLINIC)
 I '$D(NEWCONTACT) S NEWCONTACT("Contact",1)="" D BUILDJSON^SDESBUILDJSON(.RESULT,.CONTACTS) Q
 D DISPMULT(.NEWCONTACT,CONTACTIEN,CLINIC)
 D BUILDJSON^SDESBUILDJSON(.RESULT,.NEWCONTACT)
 Q
 ; return the contact ien based on the full pointer reference
GETCONTIEN(ERRORS,REQIEN,REQTYPE)  ;
 N TRGTFILE,TRGTFLD,FILEROOT,FULLREF,CONTACTDFN,TRGTDFN,CONTACTIEN,TRGTDFNFLD
 S TRGTFILE=$S("^A^RTC^V^"[(U_REQTYPE_U):409.85,"^C^P^"[(U_REQTYPE_U):123,REQTYPE="R":403.5,1:"")
 S TRGTDFNFLD=$S(TRGTFILE=409.85!(TRGTFILE="403.5"):.01,TRGTFILE=123:.02,1:"")
 S FILEROOT=$$ROOT^DILFD(TRGTFILE)
 S FULLREF=REQIEN_";"_$P(FILEROOT,U,2)
 I '$L(FULLREF) D  Q ""
 .D ERRLOG^SDESJSON(.ERRORS,391)
 ; If this entry doesn't exist, return "", because it is a NEW entry
 I '$D(^SDEC(409.86,"REQPTR",FULLREF)) Q ""
 S CONTACTIEN=$O(^SDEC(409.86,"REQPTR",FULLREF,"A"),-1)
 I 'CONTACTIEN D  Q ""
 .D ERRLOG^SDESJSON(.ERRORS,392)
 S CONTACTDFN=$$GET1^DIQ(409.86,CONTACTIEN,.01,"I")
 S TRGTDFN=$$GET1^DIQ(TRGTFILE,REQIEN,TRGTDFNFLD,"I")
 ; check for DFN match
 I CONTACTDFN'=TRGTDFN D  Q ""
 .D ERRLOG^SDESJSON(.ERRORS,393)
 Q CONTACTIEN
 ; add a new entry SDEC CONTACTS file (#409.86)
BLDNEWCONT(FDA,IENS,DFN,CLINIC,PREFDATE,REQTYPE,SDREQPTR40986) ;=
 S FDA(409.86,IENS,.01)=DFN
 S FDA(409.86,IENS,1)=CLINIC
 S FDA(409.86,IENS,2)=PREFDATE
 S FDA(409.86,IENS,2.1)=REQTYPE
 ; Main Sequence (2.2) is always set to 1 initially
 S FDA(409.86,IENS,2.2)=1
 S FDA(409.86,IENS,2.3)=SDREQPTR40986
 Q
 ; add a new entry to the Date/time of contact multiple in the SDEC CONTACTS file (#409.86)
BLDNEWATTMPT(FDA,IENS,DTTMOFCONTACT,CONTACTTYPE,COMMENTS,DUZ,DTTMENTERED,LEFTMSG,SEQUENCE)   ;
 S FDA(409.863,IENS,.01)=DTTMOFCONTACT
 S FDA(409.863,IENS,1)=CONTACTTYPE
 S FDA(409.863,IENS,2)=COMMENTS
 S FDA(409.863,IENS,3)=$G(LEFTMSG)
 ; The first entry in this subfile will always be 1
 S FDA(409.863,IENS,4)=SEQUENCE
 S FDA(409.863,IENS,5)=$G(DUZ)
 S FDA(409.863,IENS,6)=DTTMENTERED
 Q
 ;
 ; SDES CONTACT DISPLAY SINGLE
DISPLAY(RESULT,REQTYPE,REQIEN) ;
 N ERRORS,CONTACTIEN,RECALLP01,APPTREQP01,CONTACTP01,CONSULTP02,VPTR,CONTACTS
 S REQTYPE=$G(REQTYPE),REQIEN=$G(REQIEN)
 D VALREQTYPE(.ERRORS,REQTYPE,"^R^A^RTC^C^P^V^")
 I $D(ERRORS) S ERRORS("Contact",1)="" D BUILDJSON^SDESBUILDJSON(.RESULT,.ERRORS) Q
 D VALREQIEN(.ERRORS,REQIEN,REQTYPE)
 I $D(ERRORS) S ERRORS("Contact",1)="" D BUILDJSON^SDESBUILDJSON(.RESULT,.ERRORS) Q
 S CONTACTIEN=$$GETCONTIEN(.ERRORS,REQIEN,REQTYPE)
 I 'CONTACTIEN S ERRORS("Contact",1)="" D BUILDJSON^SDESBUILDJSON(.RESULT,.ERRORS) Q
 S VPTR=$$GET1^DIQ(409.86,CONTACTIEN,2.3,"I")
 I $P(VPTR,";")'=REQIEN D  Q
 .S ERRORS("Contact",1)=""
 .D ERRLOG^SDESJSON(.ERRORS,394)
 .D BUILDJSON^SDESBUILDJSON(.RESULT,.ERRORS)
 D BLDCONTACT(.CONTACTS,CONTACTIEN)
 I $D(ERRORS) S ERRORS("Contact",1)="" D BUILDJSON^SDESBUILDJSON(.RESULT,.ERRORS) Q
 I '$D(CONTACTS) S CONTACTS("Contact",1)="" D BUILDJSON^SDESBUILDJSON(.RESULT,.CONTACTS) Q
 D DISPMULT(.CONTACTS,CONTACTIEN)
 D BUILDJSON^SDESBUILDJSON(.RESULT,.CONTACTS)
 Q
DISPMULT(RESULT,CONTACTIEN,CLINIC) ;
 ; RPC: SDES CONTACT MULTI-DISPLAY
 N ERRORS,CONTMULT,CIENS,CONTDATA,CCNT,CONTACTS,CONTDATE,DTTMENTERED
 S CONTACTIEN=$G(CONTACTIEN)
 S CCNT=0
 S CONTMULT=0 F  S CONTMULT=$O(^SDEC(409.86,CONTACTIEN,1,CONTMULT)) Q:'CONTMULT  D
 .S CIENS=CONTMULT_","_CONTACTIEN_","
 .D GETS^DIQ(409.863,CIENS,"**","IE","CONTDATA","CERR")
 .I $D(CERR) K CERR Q
 .I '$G(CLINIC) S CLINIC=$$GET1^DIQ(409.86,CONTACTIEN,1,"I")
 .S CCNT=CCNT+1
 .S CONTDATE=$G(CONTDATA(409.863,CIENS,.01,"I"))
 .S CONTDATE=$$FMTISO^SDAMUTDT(CONTDATE,$G(CLINIC))
 .S CONTACTS("ContactAttempts",CCNT,"DateTimeOfContact")=CONTDATE
 .S CONTACTS("ContactAttempts",CCNT,"Type")=$G(CONTDATA(409.863,CIENS,1,"E"))
 .S CONTACTS("ContactAttempts",CCNT,"Comments")=$G(CONTDATA(409.863,CIENS,2,"E"))
 .S CONTACTS("ContactAttempts",CCNT,"LeftMessage")=$G(CONTDATA(409.863,CIENS,3,"E"))
 .S CONTACTS("ContactAttempts",CCNT,"Sequence")=$G(CONTDATA(409.863,CIENS,4,"E"))
 .S CONTACTS("ContactAttempts",CCNT,"EnteredByName")=$G(CONTDATA(409.863,CIENS,5,"E"))
 .S CONTACTS("ContactAttempts",CCNT,"EnteredByIEN")=$G(CONTDATA(409.863,CIENS,5,"I"))
 .S CONTACTS("ContactAttempts",CCNT,"EnteredBySecID")=$$GET1^DIQ(200,$G(CONTDATA(409.863,CIENS,5,"I")),205.1,"E")
 .S DTTMENTERED=$$FMTISO^SDAMUTDT($G(CONTDATA(409.863,CIENS,6,"I")),$G(CLINIC))
 .S CONTACTS("ContactAttempts",CCNT,"DateTimeEntered")=DTTMENTERED
 .K CONTDATA
 I '$D(CONTACTS) S CONTACTS("ContactAttempts",1)=""
 M RESULT=CONTACTS
 Q
BLDCONTACT(RESULT,IEN,CLINIC) ;
 N F,IENS,ERR,PREFDATE,STOPIEN
 S F=409.86,IENS=IEN_","
 D GETS^DIQ(409.86,IENS,"**","IE","CONTDATA","ERR")
 Q:$D(ERR)
 I '$G(CLINIC) S CLINIC=$G(CONTDATA(F,IENS,1,"I"))
 S PREFDATE=$$FMTISO^SDAMUTDT($G(CONTDATA(F,IENS,2,"I")),$G(CLINIC))
 I PREFDATE<0 S PREFDATE=""
 S RESULT("Contact","ID")=$P(IENS,",")
 S RESULT("Contact","Patient")=$G(CONTDATA(F,IENS,.01,"I"))
 S RESULT("Contact","Clinic")=$G(CONTDATA(F,IENS,1,"I"))
 S STOPIEN=$$GET1^DIQ(44,CLINIC,8,"I")
 S RESULT("Contact","ClinicStopCodeAMIS")=$$STOPCODETOAMIS^SDESUTIL(STOPIEN)
 S RESULT("Contact","PreferredDate")=PREFDATE
 S RESULT("Contact","RequestType")=$G(CONTDATA(F,IENS,2.1,"I"))
 S RESULT("Contact","MainSequence")=$G(CONTDATA(F,IENS,2.2,"I"))
 N SRVSTRING
 S SRVSTRING=$$GETSRV^SDES2CONTACTS($G(CONTDATA(F,IENS,2.1,"I")),+$G(CONTDATA(F,IENS,2.3,"I")))
 S RESULT("Contact","Service")=$P($G(SRVSTRING),"^")
 S RESULT("Contact","ServiceName")=$P($G(SRVSTRING),"^",2)
 S RESULT("Contact","RequestPointer")=$G(CONTDATA(F,IENS,2.3,"I"))
 K CONTDATA
 Q
 ; RECALLREQPTR is needed to find the old CONTACT entry tied to a RECALL REMINDER and re-point it to the new entry
 ; NEWREQLINK is ONLY passed in if this was a recall request that is being reopened as an appointment request
 ; REQIEN is the 409.85 request ien for CONSULTS and APPT type records
UPDCONTSEQ(DFN,REQIEN,NEWREQLINK,RECALLREQPTR)  ; update contact attempts main sequence
 N IEN40986,REC409860,FOUND,SDECFDA,REC40986PTR
 S IEN40986="",FOUND=0
 F  S IEN40986=$O(^SDEC(409.86,"B",DFN,IEN40986)) Q:IEN40986=""!(FOUND)  D
 .S REC40986PTR=$P($$GET1^DIQ(409.86,IEN40986,2.3,"I"),";")
 .I $G(RECALLREQPTR),$G(RECALLREQPTR)'=+REC40986PTR Q
 .I '$G(RECALLREQPTR),REQIEN'=REC40986PTR Q
 .K SDECFDA
 .S SDECFDA(409.86,IEN40986_",",2.2)=$O(^SDEC(409.86,IEN40986,1,9999),-1)+1
 .I $G(NEWREQLINK)]"" D
 ..S SDECFDA(409.86,IEN40986_",",2.1)="A"
 ..S SDECFDA(409.86,IEN40986_",",2.3)=NEWREQLINK
 .D FILE^DIE("","SDECFDA") K SDECFDA
 .S FOUND=1
 Q
 ; validate clinic
VALIDATECLINIC(ERRORS,CLINICIEN) ;
 I '$D(^SC(CLINICIEN,0)) D ERRLOG^SDESJSON(.ERRORS,19) Q
 Q
 ; validate contact request type
VALREQTYPE(ERRORS,REQTYPE,RESTRICT2LIST) ;
 N RESULTS,CONT,CODE,INTCODE,FOUND
 I REQTYPE="" D ERRLOG^SDESJSON(.ERRORS,395)
 D FIELD^DID(409.86,2.1,"","SET OF CODES","RESULTS")
 S FOUND=0
 F CONT=1:1:$L(RESULTS("SET OF CODES"),";") D  Q:FOUND
 .S CODE=$P(RESULTS("SET OF CODES"),";",CONT) Q:'$L(CODE)
 .S INTCODE=$P(CODE,":")
 .I $G(RESTRICT2LIST)]"",RESTRICT2LIST'[(U_INTCODE_U) Q
 .I REQTYPE=INTCODE S FOUND=1 Q
 I 'FOUND D ERRLOG^SDESJSON(.ERRORS,396)
 Q
 ; validate request ien
VALREQIEN(ERRORS,REQIEN,REQTYPE) ;
 I REQIEN="" D ERRLOG^SDESJSON(.ERRORS,3) Q
 I (REQTYPE="A")!(REQTYPE="RTC")!(REQTYPE="V"),'$D(^SDEC(409.85,REQIEN)) D ERRLOG^SDESJSON(.ERRORS,4) Q
 I (REQTYPE="C")!(REQTYPE="P"),'$D(^GMR(123,REQIEN)) D ERRLOG^SDESJSON(.ERRORS,4) Q
 I REQTYPE="R",'$D(^SD(403.5,REQIEN)) D ERRLOG^SDESJSON(.ERRORS,4) Q
 Q
 ; validate contact ien
VALIDATECONTIEN(ERRORS,CONTACTIEN) ;
 I CONTACTIEN="" D ERRLOG^SDESJSON(.ERRORS,398) Q
 I '$D(^SDEC(409.86,CONTACTIEN)) D ERRLOG^SDESJSON(.ERRORS,399) Q
 Q
VALCONTTYPE(ERRORS,TYPE) ;
 N RESULTS,CONT,CODE,INTCODE,FOUND,CODEINC,CODESET,FULLCODE
 I TYPE="" D ERRLOG^SDESJSON(.ERRORS,400)
 D FIELD^DID(409.863,1,"","SET OF CODES","RESULTS")
 S CODESET=$G(RESULTS("SET OF CODES"))
 S FOUND=0
 F CODEINC=1:1:$L(CODESET,";") D  Q:FOUND
 .S FULLCODE=$P(CODESET,";",CODEINC)
 .S INTCODE=$P(FULLCODE,":")
 .Q:INTCODE'=TYPE
 .S FOUND=1
 I 'FOUND D ERRLOG^SDESJSON(.ERRORS,401)
 Q
 ; FILE - file where the set of codes field lives
 ; FLD  - set of codes field
 ; VALUE - value to validate
 ; TEXT - meaningful sentence predicate to return. This will be proceeded by 'Missing set of codes value' or "Invalid set of codes value"
 ;       - (i.e, contact attempt type, appointment type)
VALSETOFCODES(ERRORS,VALUE,FILE,FLD,TEXT) ;
 N RESULTS,CONT,CODE,INTCODE,FOUND,RESULTS,ITEM
 I VALUE="" D ERRLOG^SDESJSON(.ERRORS,52,"Missing set of codes value: "_TEXT_".") Q
 D FIELD^DID(FILE,FLD,"","SET OF CODES","RESULTS")
 S FOUND=0
 F ITEM=1:1:$L(RESULTS("SET OF CODES"),";") D  Q:FOUND
 .S CODE=$P(RESULTS("SET OF CODES"),";",ITEM) Q:'$L(CODE)
 .S INTCODE=$P(CODE,":")
 .I VALUE=INTCODE S FOUND=1 Q
 I 'FOUND D ERRLOG^SDESJSON(.ERRORS,52,"Invalid set of codes value: "_TEXT_": '"_VALUE_"'.")
 Q
VALTEXTINPUT(ERRORS,COMMENTS,FILE,FLD,REQUIRED) ;
 N X,INPUTCHK,RESULTS,LABEL,HELPTEXT
 D FIELD^DID(FILE,FLD,"","INPUT TRANSFORM;HELP-PROMPT;LABEL","RESULTS")
 S INPUTCHK=$G(RESULTS("INPUT TRANSFORM"))
 S HELPTEXT=$G(RESULTS("HELP-PROMPT"))
 S LABEL=$G(RESULTS("LABEL"))
 I $G(REQUIRED),'$L($G(COMMENTS)) D ERRLOG^SDESJSON(.ERRORS,52,"Missing field: "_$S($L($G(LABEL)):LABEL_".",1:"Unknown Text Field.")) Q
 S X=COMMENTS
 X INPUTCHK
 I '$D(X) D ERRLOG^SDESJSON(.ERRORS,52,HELPTEXT)
 Q
VALCONTACTIEN(ERRORS,IEN) ;
 I 'IEN D ERRLOG^SDESJSON(.ERRORS,398) Q
 I '$D(^SDEC(409.86,IEN)) D ERRLOG^SDESJSON(.ERRORS,399)
 Q
VALLEFTMSG(ERRORS,LEFTMSG)    ;
 I LEFTMSG'=0,LEFTMSG'=1 D ERRLOG^SDESJSON(.ERRORS,402)
 Q