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

DIP12.m

Go to the documentation of this file.
  1. DIP12 ;SFISC/TKW - PROCESS FROM-TO (CONT.) ;2SEP2015
  1. ;;22.2;VA FileMan;**2**;Jan 05, 2016;Build 139
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;;Submitted to OSEHRA 5 January 2015 by the VISTA Expertise Network.
  1. ;;Based on Medsphere Systems Corporation's MSC FileMan 1051.
  1. ;;Licensed under the terms of the Apache License, Version 2.0.
  1. ;
  1. OPT ;For one SORT level (#DJ), build code to extract field & test sort criteria, build sort description. Called from DIP1 & DIP11
  1. N S,F,X,%,F1,F2,F3,T1,T2,T3,N,DIRANGE
  1. S S=$P(DPP(DJ),U),F=$P(DPP(DJ),U,2),N=$P(DPP(DJ),U,3) S:N["""" N=$$CONVQQ^DILIBF(N),DIRANGE=""
  1. S X="DISX("_DJ_")",DPP(DJ,"GET")=""
  1. GET I +$P(S,"E")=S,F D
  1. .N DIT,DIFLAG,DITT
  1. .S DIT=$$GETMETH^DIETLIBF(S,F,"TRANSFORM FOR SORT") I DIT]"" S DIFLAG="I"
  1. .D GET^DIOU(S,F,X,.%,$G(DIFLAG))
  1. .I '$D(%) S $P(DPP(DJ),U,2)=0,DPP(DJ,"GET")="S "_X_"=""""" Q ;IF THERE IS NO SUCH FIELD ANYMORE
  1. .I DIT]"" D ;TRANSFORM FOR SORT PURPOSES
  1. ..S DITT="^UTILITY($J,""TRANSF"","_DJ_",",DPP(DJ,"OUT")="S:Y]"""" Y=$G("_DITT_"Y))"
  1. ..S %=%_" N X,DIT S (X,DIT)="_X_" "_DIT_" S "_X_"=X S:X]"""" "_DITT_"X)=DIT"
  1. .S DPP(DJ,"GET")=%
  1. .I N=$P($G(^DD(S,F,0)),U) S %=$$LABEL^DIALOGZ(S,F) I %]"" S DPP(DJ,"LANG")=N,(DPP(DJ,"LANG",+$G(DUZ("LANG"))),N)=%,$P(DPP(DJ),U,3)=N ;FIELD LABEL
  1. I $D(DPP(DJ,"CM")) S DPP(DJ,"GET")=DPP(DJ,"CM")
  1. I $G(DPP(DJ,"SRTTXT"))="SORT" S DPP(DJ,"GET")=DPP(DJ,"GET")_" S:"_X_"]"""" "_X_"="_""" ""_"_X
  1. I +$P(S,"E")=S,F,$P(DPP(DJ),U,10)=2 D
  1. . N % S %=$P($G(^DD(S,F,0)),U,2) I %'["C",%'["N" Q
  1. . S DPP(DJ,"GET")=DPP(DJ,"GET")_" S:"_X_"]"""" "_X_"=+"_X
  1. . Q
  1. I $P(DPP(DJ),U,4)["@B" S %=X,DPP(DJ,"TXT")=N G O2 ;SORTING BY A BOOLEAN EXPRESSION, SO NO 'FROM' OR 'TO'
  1. I S,F=0 D BIJ^DIOU(S,.01,.%,.F) S X="D"_$G(%(S)) K %,F ;SORTING BY IEN
  1. NOTNULL I '$D(DPP(DJ,"F")) S %=$$NULL^DIOC(X,"'"),DPP(DJ,"TXT")=$$EZBLD^DIALOG(7093,N) G O2 ;'NOT NULL'
  1. RANGE D FT S DIRANGE="" S:$G(DPP(DJ,"SRTTXT"))="RANGE" DIRANGE=""" ""_"
  1. S %=""
  1. I F1="?z" D G O2
  1. ALL . I T1="z" S %="1",DPP(DJ,"TXT")="All "_N_$$EZBLD^DIALOG(7094) Q ;'INCLUDES NULLS'
  1. NULL . I T1="@" S %=$$NULL^DIOC(X),DPP(DJ,"TXT")=$$EZBLD^DIALOG(7092,N) Q ;'IS NULL'
  1. . S %=$$AFT^DIOC(DIRANGE_X,T1,"'")
  1. NULLPLUS . S DPP(DJ,"TXT")=N_$S(T3]"":" to "_T3,1:"")_$$EZBLD^DIALOG(7094) ;'INCLUDES NULLS'
  1. . Q
  1. S DPP(DJ,"TXT")=N_$S(F3]"":" from "_F3,1:"")
  1. I T1="@"!(T1="z") D G O2
  1. . S %="" I T1="@" S DPP(DJ,"TXT")=DPP(DJ,"TXT")_$$EZBLD^DIALOG(7094),%=$$NULL^DIOC(X)_"!("
  1. . S %=%_$$AFT^DIOC(DIRANGE_X,F1) S:T1="@" %=%_")"
  1. . Q
  1. I F3]"",F3=T3 S %=$$EQ^DIOC(X,T1),DPP(DJ,"TXT")=N_" equals "_F3 G O2
  1. S %=$$BTWI^DIOC(DIRANGE_X,F1,T1,"","SORT")
  1. I T3]"" S DPP(DJ,"TXT")=DPP(DJ,"TXT")_" to "_T3
  1. O2 S DPP(DJ,"QCON")="I "_%
  1. K DITYP Q
  1. ;
  1. FT ;'FROM' AND 'TO' VALUES. ALSO CALLED BY DIP1
  1. ;BUILD 'F1', THE INTERNAL VALUE OF 'FROM'
  1. S %=$G(DPP(DJ,"F")) I %="" S %=$G(DIPP(+$G(DIJ),"F"))
  1. S F1=$P(%,U),F2=$P(%,U,2),F3=$P(%,U,3) S:F3="" F3=F2 S:$E(F1)="""" F1=""""_F1
  1. I $G(DPP(DJ,"FCOMPUTED"))]"" N X M X=DPP(DJ,"FCOMPUTED") X X S Y=X D PAR^DIP1(1,Y),FRV^DIP1 S $P(DPP(1,"F"),U)=Y,(F2,F1)=X ;DO COMPUTATION NOW!!
  1. ;BUILD 'T1', THE INTERNAL VALUE OF 'TO'
  1. S %=$G(DPP(DJ,"T")) I %="" S %=$G(DIPP(+$G(DIJ),"T"))
  1. S T1=$P(%,U),T2=$P(%,U,2),T3=$P(%,U,3) S:T3="" T3=T2
  1. I $G(DPP(DJ,"TCOMPUTED"))]"" N X M X=DPP(DJ,"TCOMPUTED") X X S Y=X D PAR^DIP1(2,Y) S:DITYP=1&Y&(Y'[".") Y=Y_".24" S $P(DPP(1,"T"),U)=Y,(T2,T1)=X ;DO COMPUTATION NOW!!
  1. Q
  1. ;
  1. CK ;VALIDATE FIELDS/DATA. CALLED BY DIP1
  1. G QQ:X[U I X="@" S Y=X K DPP(DJ,"IX"),DPP(DJ,"PTRIX") Q
  1. I $D(DITYP("D")) D G:Y=-1 QQ Q ;ASK FOR A DATE EXTENDED DATA TYPE MIGHT BE DATE-VALUED
  1. .N %DT S %DT=""
  1. .S:$G(DITYP("D"))["T" %DT="T"
  1. .S:$G(DITYP("D"))["S" %DT=%DT_"S"
  1. .S %DT=%DT_$E("E",(DIFRTO="?"))
  1. .D ^%DT I Y>0 D S Y(0)=%DT
  1. ..S %DT=Y N Y S Y=%DT X ^DD("DD") S %DT=Y
  1. I $D(DITYP("S"))>9 D G:Y=-1 QQ Q ;ASK FOR A 'SET' VALUE EXTENDED DATA TYPE MIGHT HAVE 'SET OF CODES'
  1. . S Y=$G(DITYP("S","E",X)) I Y]"" S Y(0)=Y_" ("_X_")" W:DIFRTO="?" " ",$$EZBLD^DIALOG(8146,Y) Q
  1. . I $D(DITYP("S","I",X)) S Y=X,Y(0)=X_" ("_DITYP("S","I",X)_")" W:DIFRTO="?" " "_DITYP("S","I",X) Q
  1. . S D=$O(DITYP("S","E",X)) I D]"",$P(D,X)="" S Y=DITYP("S","E",D),Y(0)=Y_" ("_D_")" W:DIFRTO="?" $P(D,X,2,9)_" ",$$EZBLD^DIALOG(8146,Y) Q ;'USES INTERNAL CODE SUCH&SUCH'
  1. . I DIFRTO'="?" S Y=X Q
  1. . S Y=-1 Q
  1. I +$P(X,"E")=X!(DITYP'=2) S Y=X Q
  1. QQ S Y=-1 D Q:$G(DIQUIET)
  1. .N I S I(1)=X,I(2)=$P($G(^DI(.81,DITYP,0)),U),DIERR=$$EZBLD^DIALOG(330,.I) ;'INVALID ENTRY'
  1. W $C(7),"??",!?8,DIERR Q