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

DIKKUTL4.m

Go to the documentation of this file.
  1. DIKKUTL4 ;SFISC/MKO-KEY DEFINITION, READER PROMPTS ;10:01 AM 15 Jul 1998
  1. ;;22.2;VA FileMan;;Jan 05, 2016;Build 42
  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. ;==================
  1. ; $$RORM(ufld,fld)
  1. ;==================
  1. ;Prompt for method to resolve difference between fields in key
  1. ;and fields in uniqueness index.
  1. ; Called from EDIT when key fields and UI fields don't match.
  1. ;In:
  1. ; $G(DIKKUFLD) : include option 2 (there are UI fields)
  1. ; $G(DIKKFLD) : include option 3 (there are key fields)
  1. ;Returns:
  1. ; 1 : Re-edit the key
  1. ; 2 : Make key match UI (default on ^, timeout when UI fields exist)
  1. ; 3 : Make UI match key (default on ^, timeout when no UI fields)
  1. ;
  1. RORM(DIKKUFLD,DIKKFLD) ;
  1. N DIKKOPT,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. W !!,"The Key fields and the fields in the Uniqueness Index don't match."
  1. S DIR(0)="S^1:Re-Edit the Key",DIKKOPT=1
  1. S:$G(DIKKUFLD) DIKKOPT=2,DIR(0)=DIR(0)_";2:Make Key match Uniqueness Index (also selected on up-arrow)"
  1. 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:"")
  1. D ^DIR
  1. I '$G(DIKKUFLD) Q $S($D(DIRUT):3,Y=2:3,1:Y)
  1. Q $S($D(DIRUT):2,1:Y)
  1. ;
  1. ;===========================
  1. ; $$EDORD(KeyIdString,flag)
  1. ;===========================
  1. ;Prompt edit or delete the key.
  1. ; Called from EDIT^DIKKUTL when there are no key fields and
  1. ; either no Uniqueness Index or no UI fields.
  1. ;In:
  1. ; DIKKID = string that identifies the key -- used in message
  1. ; DIKKFL = controls message (there are neither key nor UI fields)
  1. ;Returns:
  1. ; 1 : Re-edit the key
  1. ; 2 : Delete the key (default on ^, timeout)
  1. ;
  1. EORD(DIKKID,DIKKFL) ;Choose to edit or delete the key.
  1. N DIKKMSG,DIR,DIROUT,DIRUT,DTOUT,DUOUT,I,X,Y
  1. ;
  1. ;Write message that key definition is incomplete
  1. I '$G(DIKKFL) S DIKKMSG(0)=$C(7)_"NOTE: "_DIKKID_" has neither fields nor a Uniqueness Index defined."
  1. E S DIKKMSG(0)=$C(7)_"NOTE: "_DIKKID_" and its Uniqueness Index have no fields defined."
  1. D WRAP^DIKCU2(.DIKKMSG,-7,0)
  1. W ! F I=0:1 Q:'$D(DIKKMSG(I)) W !,@$S(I:"?6",1:"?0"),DIKKMSG(I)
  1. ;
  1. ;Prompt 'Re-edit' or 'Delete'
  1. S DIR(0)="S^1:Re-edit the Key;2:Delete the Key (also selected on up-arrow)"
  1. D ^DIR
  1. Q $S($D(DIRUT):2,1:Y)
  1. ;
  1. ;==========
  1. ; $$EDORC
  1. ;==========
  1. ;Prompt whether edit key, delete key, or create a Uniqueness Index.
  1. ; Called from EDIT^DIKKUTL when the user chose to create a new UI
  1. ; but failed to provide a name for that Index.
  1. ;Returns:
  1. ; 1 : Re-edit the key
  1. ; 2 : Delete the key (default on ^, timeout)
  1. ; 3 : Create a new Uniqueness Index
  1. ;
  1. EDORC() ;Choose to edit key, delete key, or create a Uniqueness Index
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. ;
  1. W !,$C(7)_"NOTE: All Keys must have a Uniqueness Index defined."
  1. S DIR(0)="S^1:Re-edit the Key;2:Delete the Key (also selected on up-arrow);3:Create a Uniqueness Index"
  1. S DIR("?")="All Keys must have a Uniqueness index defined."
  1. D ^DIR
  1. Q $S($D(DIRUT):2,1:Y)
  1. ;
  1. ;==========
  1. ; $$EDORI
  1. ;==========
  1. ;Prompt whether to delete, re-edit, or ignore
  1. ; Called from EDIT^DIKKUTL when the key fails integrity check.
  1. ;Returns:
  1. ; 1 : Delete the Key
  1. ; 2 : Re-Edit the Key
  1. ; 3 : Ignore problem
  1. ;
  1. EDORI() ;Choose to edit key, delete key, or create a Uniqueness Index
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. ;
  1. W !!,$C(7)_"ERROR: The key is not unique and/or some records have key field values missing."
  1. 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)"
  1. S DIR("?")="The Key is invalid because it is not unique and/or some records have missing key field values."
  1. D ^DIR
  1. Q $S($D(DIRUT):1,1:Y)