| 1 | DIKKUTL4 ;SFISC/MKO-KEY DEFINITION, READER PROMPTS ;10:01 AM  15 Jul 1998
 | 
|---|
| 2 |  ;;22.0;VA FileMan;;Mar 30, 1999
 | 
|---|
| 3 |  ;Per VHA Directive 10-93-142, this routine should not be modified.
 | 
|---|
| 4 |  ;
 | 
|---|
| 5 |  ;==================
 | 
|---|
| 6 |  ; $$RORM(ufld,fld)
 | 
|---|
| 7 |  ;==================
 | 
|---|
| 8 |  ;Prompt for method to resolve difference between fields in key
 | 
|---|
| 9 |  ;and fields in uniqueness index.
 | 
|---|
| 10 |  ; Called from EDIT when key fields and UI fields don't match.
 | 
|---|
| 11 |  ;In:
 | 
|---|
| 12 |  ; $G(DIKKUFLD) : include option 2 (there are UI fields)
 | 
|---|
| 13 |  ; $G(DIKKFLD)  : include option 3 (there are key fields)
 | 
|---|
| 14 |  ;Returns:
 | 
|---|
| 15 |  ; 1 : Re-edit the key
 | 
|---|
| 16 |  ; 2 : Make key match UI (default on ^, timeout when UI fields exist)
 | 
|---|
| 17 |  ; 3 : Make UI match key (default on ^, timeout when no UI fields)
 | 
|---|
| 18 |  ;
 | 
|---|
| 19 | RORM(DIKKUFLD,DIKKFLD) ;
 | 
|---|
| 20 |  N DIKKOPT,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
 | 
|---|
| 21 |  W !!,"The Key fields and the fields in the Uniqueness Index don't match."
 | 
|---|
| 22 |  S DIR(0)="S^1:Re-Edit the Key",DIKKOPT=1
 | 
|---|
| 23 |  S:$G(DIKKUFLD) DIKKOPT=2,DIR(0)=DIR(0)_";2:Make Key match Uniqueness Index (also selected on up-arrow)"
 | 
|---|
| 24 |  S:$G(DIKKFLD) DIKKOPT=DIKKOPT+1,DIR(0)=DIR(0)_";"_DIKKOPT_":Make Uniqueness Index match Key"_$S(DIKKOPT=2:" (also selected on up-arrow)",1:"")
 | 
|---|
| 25 |  D ^DIR
 | 
|---|
| 26 |  I '$G(DIKKUFLD) Q $S($D(DIRUT):3,Y=2:3,1:Y)
 | 
|---|
| 27 |  Q $S($D(DIRUT):2,1:Y)
 | 
|---|
| 28 |  ;
 | 
|---|
| 29 |  ;===========================
 | 
|---|
| 30 |  ; $$EDORD(KeyIdString,flag)
 | 
|---|
| 31 |  ;===========================
 | 
|---|
| 32 |  ;Prompt edit or delete the key.
 | 
|---|
| 33 |  ; Called from EDIT^DIKKUTL when there are no key fields and
 | 
|---|
| 34 |  ; either no Uniqueness Index or no UI fields.
 | 
|---|
| 35 |  ;In:
 | 
|---|
| 36 |  ; DIKKID = string that identifies the key -- used in message
 | 
|---|
| 37 |  ; DIKKFL = controls message (there are neither key nor UI fields)
 | 
|---|
| 38 |  ;Returns:
 | 
|---|
| 39 |  ; 1 : Re-edit the key
 | 
|---|
| 40 |  ; 2 : Delete the key (default on ^, timeout)
 | 
|---|
| 41 |  ;
 | 
|---|
| 42 | EORD(DIKKID,DIKKFL) ;Choose to edit or delete the key.
 | 
|---|
| 43 |  N DIKKMSG,DIR,DIROUT,DIRUT,DTOUT,DUOUT,I,X,Y
 | 
|---|
| 44 |  ;
 | 
|---|
| 45 |  ;Write message that key definition is incomplete
 | 
|---|
| 46 |  I '$G(DIKKFL) S DIKKMSG(0)=$C(7)_"NOTE: "_DIKKID_" has neither fields nor a Uniqueness Index defined."
 | 
|---|
| 47 |  E  S DIKKMSG(0)=$C(7)_"NOTE: "_DIKKID_" and its Uniqueness Index have no fields defined."
 | 
|---|
| 48 |  D WRAP^DIKCU2(.DIKKMSG,-7,0)
 | 
|---|
| 49 |  W ! F I=0:1 Q:'$D(DIKKMSG(I))  W !,@$S(I:"?6",1:"?0"),DIKKMSG(I)
 | 
|---|
| 50 |  ;
 | 
|---|
| 51 |  ;Prompt 'Re-edit' or 'Delete'
 | 
|---|
| 52 |  S DIR(0)="S^1:Re-edit the Key;2:Delete the Key (also selected on up-arrow)"
 | 
|---|
| 53 |  D ^DIR
 | 
|---|
| 54 |  Q $S($D(DIRUT):2,1:Y)
 | 
|---|
| 55 |  ;
 | 
|---|
| 56 |  ;==========
 | 
|---|
| 57 |  ; $$EDORC
 | 
|---|
| 58 |  ;==========
 | 
|---|
| 59 |  ;Prompt whether edit key, delete key, or create a Uniqueness Index.
 | 
|---|
| 60 |  ;  Called from EDIT^DIKKUTL when the user chose to create a new UI
 | 
|---|
| 61 |  ;  but failed to provide a name for that Index.
 | 
|---|
| 62 |  ;Returns:
 | 
|---|
| 63 |  ; 1 : Re-edit the key
 | 
|---|
| 64 |  ; 2 : Delete the key (default on ^, timeout)
 | 
|---|
| 65 |  ; 3 : Create a new Uniqueness Index
 | 
|---|
| 66 |  ;
 | 
|---|
| 67 | EDORC() ;Choose to edit key, delete key, or create a Uniqueness Index
 | 
|---|
| 68 |  N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
 | 
|---|
| 69 |  ;
 | 
|---|
| 70 |  W !,$C(7)_"NOTE: All Keys must have a Uniqueness Index defined."
 | 
|---|
| 71 |  S DIR(0)="S^1:Re-edit the Key;2:Delete the Key (also selected on up-arrow);3:Create a Uniqueness Index"
 | 
|---|
| 72 |  S DIR("?")="All Keys must have a Uniqueness index defined."
 | 
|---|
| 73 |  D ^DIR
 | 
|---|
| 74 |  Q $S($D(DIRUT):2,1:Y)
 | 
|---|
| 75 |  ;
 | 
|---|
| 76 |  ;==========
 | 
|---|
| 77 |  ; $$EDORI
 | 
|---|
| 78 |  ;==========
 | 
|---|
| 79 |  ;Prompt whether to delete, re-edit, or ignore
 | 
|---|
| 80 |  ; Called from EDIT^DIKKUTL when the key fails integrity check.
 | 
|---|
| 81 |  ;Returns:
 | 
|---|
| 82 |  ; 1 : Delete the Key
 | 
|---|
| 83 |  ; 2 : Re-Edit the Key
 | 
|---|
| 84 |  ; 3 : Ignore problem
 | 
|---|
| 85 |  ;
 | 
|---|
| 86 | EDORI() ;Choose to edit key, delete key, or create a Uniqueness Index
 | 
|---|
| 87 |  N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
 | 
|---|
| 88 |  ;
 | 
|---|
| 89 |  W !!,$C(7)_"ERROR: The key is not unique and/or some records have key field values missing."
 | 
|---|
| 90 |  S DIR(0)="S^1:Delete the Key (also selected on up-arrow);2:Re-Edit the Key;3:Ignore problem (Be sure to fix later)"
 | 
|---|
| 91 |  S DIR("?")="The Key is invalid because it is not unique and/or some records have missing key field values."
 | 
|---|
| 92 |  D ^DIR
 | 
|---|
| 93 |  Q $S($D(DIRUT):1,1:Y)
 | 
|---|