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

DICATTUD.m

Go to the documentation of this file.
  1. DICATTUD ;SFISC/MKO - USER DEFINED DATA TYPES ;24JUN2017
  1. ;;22.2;VA FileMan;**2,5,13**;Jan 05, 2016;Build 4
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. BEGIN D EN(A,DA,N,O) I $G(DTOUT) K DTOUT G CHECK^DICATT ;Come from DICATT (roll-and-scroll mode)
  1. G ^DICATT1
  1. ;
  1. ;
  1. ;
  1. SCREENMN ;Come from DICATTD (ScreenMan mode)
  1. N L,M,C,Z,DIZ,DIALLVAL,DIVAL,DTOUT,IOTM,IOBT
  1. D D CLRMSG^DDS ;Set the scrolling region in the command area
  1. .N X S IOTM=19,IOBM=$G(IOSL,24)-1,X="IOSTBM" D ENDR^%ZISS I $G(IOSTBM)]"" W @IOSTBM
  1. D EN(DICATTA,DICATTF,X,DICATT4]"")
  1. I $G(IOSTBM)]"" S IOTM=1,IOBM=$G(IOSL,24) W @IOSTBM
  1. I $G(DTOUT) QUIT
  1. S DICATT2N=$P(DIZ,U),DICATT3N="" I $$ESTORE^DICATT1(DICATT2N) D UNED^DDSUTL(20.5,"DICATT",1,2) ;don't allow 'MULTIPLE'
  1. S DICATT5N=C,DICATTLN=L
  1. S DICATTMN="" D PUT^DDSVALF(98,"DICATT",1,DICATTMN) ;HERE IS THE HELP-PROMPT, NULLED OUT FOR NOW
  1. QUIT
  1. ;
  1. ;
  1. ;
  1. ;
  1. ;
  1. ;In: N = data type number
  1. ; O = 0 : if new field
  1. ; A = file #
  1. ; DA = field #
  1. ;
  1. ;Out: DICATTPM array (to be merged into ^DD(file#,field#)
  1. ; e.g., DICATTPM(101,4,0)="4^", DICATTPM(101,4,31)="DPT(" says that POINTER property is "DPT("
  1. ; L = Maximum internal length
  1. ; M = Help text
  1. ; M(2) = 1 : user changed a default on an old field
  1. ; C = Old input transform (5-99)
  1. ; DIZ,Z = dataTypeAbbrev_t#, where # is the data type number
  1. ;
  1. ;Variables used:
  1. ; DIVAL = obtained property value
  1. ; DIVALS(abbrev) = array of property values (already obtained)
  1. ; DIVALS("DIDEF") = default property value presented to user
  1. ; DICHANGE = 1 : if user changed a default value (set in PROP)
  1. ;
  1. EN(A,DA,N,O) ;
  1. K DICATTPM,M(2),DTOUT
  1. N DIMETH,DIORD,DIPROP,DIVALS,DICHANGE,DDS
  1. M DICATTPM(101)=^DD(A,DA,101),DICATTPM(201)=^DD(A,DA,201) ;GRAB THE EXISTING VALUES OF THE PROPERTIES AND METHODS
  1. ;
  1. ;Loop through properties in Data Type file, by ORDER, and get values
  1. S DIORD=""
  1. F S DIORD=$O(^DI(.81,N,101,"AC",DIORD)) Q:'DIORD!$D(DUOUT)!$D(DTOUT) D
  1. .S DIPROP=$O(^DI(.81,N,101,"AC",DIORD,"")) Q:'DIPROP D PROPMETH("P",N,DIPROP,.DIVALS)
  1. ;If user ^-d or timed out, go back to delete field and reprompt
  1. I $D(DUOUT)!$D(DTOUT) K DUOUT,DICATTPM S DTOUT=1 Q
  1. ;Loop through methods in Data Type file
  1. S DIMETH=0
  1. I DUZ(0)="@" F S DIMETH=$O(^DI(.81,N,201,DIMETH)) Q:'DIMETH D:$G(^(DIMETH,31))="" PROPMETH("M",N,DIMETH,.DIVALS)
  1. DONE ;
  1. ;Set L and M
  1. K M
  1. S L=$$PROP4TYP^DIETLIBF("INTERNAL LENGTH",N) S:'L L=30 ;$G(DIVALS("MAXL"),30)
  1. ;S:$G(DIVALS("HELP"))]"" M=DIVALS("HELP")
  1. ;I $G(DICHANGE),O S M(2)=1
  1. ;
  1. ;Put input transform in C; don't need to store in ^DD(file#,field#,201)
  1. ;Set Z and DIZ
  1. S C="Q" ;$G(DICAT201(1,1),"Q") K DICAT201(1)
  1. S Z=$$GET1^DIQ(.81,N,"INTERNAL REPRESENTATION") S:Z="" Z="F"
  1. S (DIZ,Z)=Z_"t"_N_U
  1. QUIT
  1. ;
  1. ;
  1. ;
  1. PROPMETH(PROPMETH,N,DIPROP,DIVALS) ;For DATA TYPE N, get a PROPERTY (PROPMETH="P") or METHOD
  1. N DIPROMPT,DIVAL,DIEXEC,DIDD,DIGL
  1. K DIVALS("DIDEF")
  1. S DIDD=$S(PROPMETH="M":.87,1:.86),DIGL=$S(PROPMETH="M":201,1:101) ;CHANGED FROM '102'
  1. ;If there's an Executable Default, get value
  1. I $G(^DI(.81,N,DIGL,DIPROP,31.2))'?."^" D
  1. . S DIEXEC=1
  1. . S DIVAL=$G(^DD(A,DA,DIGL,DIPROP,2)) ;DIGL WILL BE 201, NOT 102
  1. . ;I 'O!$G(DICHANGE),^DI(.81,N,101,DIPROP,31.2)["|" S DIVAL=$$PARSE^DIETLIB(^(31.2),.DIVALS)
  1. . S DIVALS("DIDEF")=DIVAL
  1. ;
  1. ;Otherwise, get regular default
  1. E S (DIVAL,DIVALS("DIDEF"))=$$GETDEF(N,DIPROP,.DIVALS)
  1. ;
  1. ;Should user be prompted for value?
  1. S DIPROMPT=$G(^DI(.81,N,DIGL,DIPROP,31))="" ;PROMPT IF THERE IS NO VALUE
  1. I $G(^DI(.81,N,DIGL,DIPROP,10))'?."^" X $$PARSE^DIETLIB(^(10)) S DIPROMPT=$T
  1. ;
  1. ;If so, prompt for DIVAL
  1. I DIPROMPT D
  1. . ;If there's Get Code, execute it
  1. . I $G(^DI(DIDD,DIPROP,51))'?."^" D
  1. .. D XCODEM^DIETLIB(^DI(DIDD,DIPROP,51),.DIVALS,.DIVAL)
  1. .. S:$D(DIVAL)[0 DUOUT=1
  1. . ;
  1. . ;Otherwise, use ^DIR to get value of property
  1. . E S DIVAL=$$DIR(DIPROP,.DIVALS)
  1. . Q:$D(DUOUT)!$D(DTOUT)
  1. . S:DIVAL'=DIVALS("DIDEF") DICHANGE=1
  1. ;
  1. Q:$D(DUOUT)!$D(DTOUT)
  1. D SAVE(DIPROP,.DIVAL,.DIVALS,.DIGL,$G(DIEXEC))
  1. Q
  1. ;
  1. DIR(DIPROP,DIVALS) ;Do a ^DIR read to get value for property or method
  1. N I,J,X,Y,DIR,DIRUT,DIROUT
  1. ;
  1. ;Get DIR(0) from the PROPERTY or METHOD, (convert |abbr| to values)
  1. S DIR(0)=$$PARSE^DIETLIB($G(^DI(DIDD,DIPROP,42)),.DIVALS)
  1. Q:DIR(0)="" ""
  1. A ;Put Prompt into DIR("A")
  1. S I=0
  1. S J=1,DIR("A",1)=$P($G(^DI(DIDD,DIPROP,0)),U)
  1. F S I=$O(^DI(DIDD,DIPROP,43,I)) Q:'I D:$D(^(I,0))#2
  1. . S J=J+1
  1. . S DIR("A",J)=^DI(DIDD,DIPROP,43,I,0)
  1. I J S DIR("A")=DIR("A",J) K DIR("A",J)
  1. H ;Put Help into DIR("?")
  1. S (I,J)=0
  1. I $G(^DI(DIDD,DIPROP,11))]"" S J=1,DIR("?",1)=^(11)
  1. F S I=$O(^DI(DIDD,DIPROP,44,I)) Q:'I D:$D(^(I,0))#2
  1. . S J=J+1
  1. . S DIR("?",J)=^DI(DIDD,DIPROP,44,I,0)
  1. I J S DIR("?")=DIR("?",J) K DIR("?",J)
  1. B ;Put default into DIR("B")
  1. S I=$G(DICATTPM(DIGL,DIPROP,31)) ;get the current VALUE
  1. I I="" S I=$G(DIVALS("DIDEF")) ;or get the DEFAULT from node 33 of the PROPERTY for this DATA TYPE
  1. I I]"" D S DIR("B")=I
  1. .I DIGL=101 D
  1. ..N T S T=+$G(^DI(.86,DIPROP,41)) ;get the TYPE
  1. ..I T=1 S I=$$DATE^DIUTL(I)
  1. ..I T=3 S I=$P($P($P(DIR(0),U,2),I_":",2),";")
  1. ;S:$G(DIVALS("DIDEF"))]"" DIR("B")=DIVALS("DIDEF")
  1. S:$G(^DI(DIDD,DIPROP,45))]"" DIR("S")=^(45)
  1. S:$G(^DI(DIDD,DIPROP,46))]"" DIR("T")=^(46)
  1. D ^DIR
  1. Q Y
  1. ;
  1. ;
  1. SAVE(DIPROP,DIVAL,DIVALS,DICAT101,DIEXEC) ;Save the value of the property
  1. ; in DIVALS(abbr) and DICAT101
  1. ;DIVAL is the value of the property
  1. ;DIEXEC = 1 : if value is an executable
  1. ;
  1. ;Returns:
  1. ; DIVALS(abbr)= array property values
  1. ; DICATTPM(DIGL,prop#,0)=prop#^abbrev
  1. ; DICATTPM(DIGL,prop#,31)=value
  1. ; or 2)=executable value
  1. ; DICATTPM(DIGL,prop#,3,n,0) = descendent node n of DIVAL
  1. ;
  1. N DIABBR
  1. ;
  1. ;Set the DIVALS array
  1. S DIABBR=$P(^DI(DIDD,DIPROP,0),U,2)
  1. S:DIABBR]"" DIVALS(DIABBR)=DIVAL
  1. ;
  1. ;Set the DICATTPM array
  1. I DIVAL]"" D
  1. .N I,Z S Z=0 F I=1:1 S Z=$O(DICATTPM(DIGL,Z)) Q:'Z
  1. .S DICATTPM(DIGL,0)="^."_DIGL_"01P^"_DIPROP_"^"_I ;remember that DIGL=101 or 201
  1. . S DICATTPM(DIGL,DIPROP,0)=DIPROP_U_DIABBR
  1. . S DICATTPM(DIGL,DIPROP,31+$G(DIEXEC))=DIVAL
  1. . I $D(DIVAL)>9 S I="" F S I=$O(DIVAL(I)) Q:I="" D
  1. .. I $D(DIVAL(I))#2 S DICATTPM(DIGL,DIPROP,3,I,0)=DIVAL(I)
  1. .. E I $D(DIVAL(I,0))#2 S DICATTPM(DIGL,DIPROP,3,I,0)=DIVAL(I,0)
  1. .. E Q
  1. ;
  1. ;Execute the post action
  1. ;X:$G(^DI(.81,N,101,DIPROP,61))'?."^" $$PARSE^DIETLIB(^(61))
  1. Q
  1. ;
  1. ;
  1. GETDEF(N,DIPROP,DIVALS) ;Get defaults for a property.
  1. ;May come from the ^DD or the data type file.
  1. N DIDEF
  1. ;
  1. ;Get value from ^DD
  1. S DIDEF=$S(DIPROP=3:$G(^DD(A,DA,3)),1:$G(^DD(A,DA,101,DIPROP,31)))
  1. ;
  1. ;For existing fields, return default from ^DD(file#,field#)
  1. ;if the user hasn't changed any property values
  1. I O,'$G(DICHANGE) Q DIDEF
  1. ;
  1. ;Otherwise, look at default from Data Type file.
  1. ;For existing fields where default contains no |abbr|,
  1. ;return value from DD.
  1. ;
  1. ;Default
  1. S DIDEF=$G(^DI(.81,N,101,DIPROP,33))
  1. ;Q:$G(^DI(.81,N,101,DIPROP,31))]"" $S(^(31)'["|"&O:DIDEF,1:$$PARSE^DIETLIB(^(31),.DIVALS))
  1. ;
  1. ;Build Default
  1. ;Q:$G(^DI(.81,N,101,DIPROP,31.1))]"" $S(^(31.1)'["|"&O:DIDEF,1:$$XCODE^DIETLIB(^(31.1),.DIVALS)) ;NOT THERE ANY MORE
  1. ;
  1. Q DIDEF