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

AMHLSW.m

Go to the documentation of this file.
AMHLSW ; IHS/CMI/LAB - SWITCH TO V FILE ;
 ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
 ;
 ; AMHLSWD=DICTIONARY NUMBER
 ; AMHLSWCR=LINKING CROSS REFERENCE
 ; AMHLSWV=VISIT DFN
 ;
 S U="^"
 S AMHLOOK=""
 Q:'$D(AMHSWV)
 Q:AMHSWV=""
 Q:'$D(AMHSWD)
 Q:'AMHSWD
 Q:'$D(^DIC(AMHSWD,0,"GL"))
 S AMHSWG=^DIC(AMHSWD,0,"GL")
 I '$D(AMHSWCR),AMHSWD'=(AMHSWD\1),AMHSWD\1=9000010 S AMHSWCR="AD"
 I '$D(AMHSWCR),AMHSWD\1'=9000010 S AMHSWCR="AC"
 Q:'$D(AMHSWCR)
 Q:AMHSWCR=""
 W !
 S AMHSWDA=0 F AMHSWI=1:1 S AMHSWDA=$O(@(AMHSWG_""""_AMHSWCR_""",AMHSWV,AMHSWDA)")) Q:AMHSWDA=""  S DIC=AMHSWG,Y=AMHSWDA D GETVAL,WRITE
 S AMHSWI=AMHSWI-1
 S AMHSWAN="" S:AMHSWI=1 AMHSWAN=AMHSWI
RDR I AMHSWAN="",AMHSWI R !!,"Choose: ",AMHSWAN:$S($D(DTIME):DTIME,1:300)
 I AMHSWAN,$D(AMHSWT(AMHSWAN)) S AMHLOOK=AMHSWT(AMHSWAN)
 K AMHSWV,AMHSWVA,AMHSWL,AMHSWCR,AMHSWD,AMHSWG,AMHSWDA,AMHSWI,AMHSWAN,AMHSWT,AMHSWN,AMHSWEX,AMHSWL,AMHSWP,AMHSWZ,AMHSWD2,AMHSWG2,AMHSWV2,Y
 W !
 Q
 ;
GETVAL ;
 S AMHSWD2=AMHSWD,AMHSWG2=AMHSWG,AMHSWV2=AMHSWDA
 F AMHSWL=0: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