source: FOIAVistA/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DIKKFORM.m@ 711

Last change on this file since 711 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.8 KB
Line 
1DIKKFORM ;SFISC/MKO-ENTRY POINTS FOR THE 'DIKC EDIT' FORM ;11:34 AM 16 Nov 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 ; [DIKK EDIT] entry points
7 ;==========================
8 ;
9PRIOVAL ;Validation on Priority (#1)
10 Q:$P(^DD("KEY",DA,0),U,3)=X
11 N PK
12 I X="P" D
13 . S PK=$O(^DD("KEY","AP",$$GET^DDSVAL(.31,DA,.01),"P",0)) Q:'PK
14 . S DDSERROR=1
15 . D HLP^DDSUTL($C(7)_"Primary Key '"_$P(^DD("KEY",PK,0),U,2)_"' is already defined on this file.")
16 Q
17 ;
18UIVAL ;Validation on Uniqueness Index (#3)
19 ;Index must be Regular, used for Lookup/Sorting, have no set/kill
20 ;conditions, and consist only of field-type cross reference values
21 ;with no transforms.
22 Q:X=""
23 N CRV,FIL,FLD,LN0,SS
24 ;
25 ;Check that Index is regular and has no set/kill condition
26 I $P($G(^DD("IX",X,0)),U,4)'="R" D UIERR("Selected index is not a Regular index.") Q
27 I $P($G(^DD("IX",X,0)),U,14)'="LS"!($E($P($G(^(0)),U,2))="A") D UIERR("Selected index is not used for Lookup.") Q
28 D:$G(^DD("IX",X,1.4))'?."^" UIERR("Selected index has a Set Condition.")
29 D:$G(^DD("IX",X,2.4))'?."^" UIERR("Selected index has a Kill Condition.")
30 ;
31 ;Check Cross Reference Values
32 S CRV=0 F S CRV=$O(^DD("IX",X,11.1,CRV)) Q:'CRV D
33 . S LN0=$G(^DD("IX",X,11.1,CRV,0))
34 . I $P(LN0,U,2)'="F" D UIERR("Selected index has a computed value.") Q
35 . I $G(^DD("IX",X,11.1,CRV,2))'?."^" D UIERR("Selected index has a value with a transform.") Q
36 Q
37 ;
38UIERR(MSG) ;Set DDSERROR=1 and print MSG
39 N X
40 S DDSERROR=1
41 D HLP^DDSUTL($C(7)_$G(MSG))
42 Q
43 ;
44FORMDV ;Form-Level Data Validation
45 ;In the Fields multiple, check that Sequence Numbers are unique and
46 ;consecutive from 1.
47 ;(Duplicate file/field combinations are checked automatically
48 ;because they're key fields.)
49 N DIKKDA,DIKKI,DIKKLIST,DIKKSQ
50 ;
51 ;Build list
52 ; DIKKLIST(seq#,ien)
53 ;while checking for duplicates
54 ;
55 S DIKKDA(1)=DA
56 S DIKKDA=0 F S DIKKDA=$O(^DD("KEY",DA,2,DIKKDA)) Q:'DIKKDA D
57 . S DIKKSQ=$$GET^DDSVAL(.312,.DIKKDA,1)
58 . I $D(DIKKLIST(DIKKSQ)) D
59 .. D:'$D(DDSERROR) MSG^DDSUTL($C(7)_"UNABLE TO SAVE CHANGES")
60 .. S DDSERROR=1
61 .. D MSG^DDSUTL("The sequence number "_DIKKSQ_" is used more than once.")
62 . E S DIKKLIST(DIKKSQ,DIKKDA)=""
63 ;
64 ;If no duplicates, check that sequence numbers are consecutive from 1
65 I '$D(DDSERROR) D
66 . S DIKKSQ=0
67 . F DIKKI=1:1 S DIKKSQ=$O(DIKKLIST(DIKKSQ)) Q:'DIKKSQ!$G(DDSERROR) D:DIKKSQ'=DIKKI
68 .. S DDSERROR=1
69 .. D MSG^DDSUTL($C(7)_"UNABLE TO SAVE CHANGES")
70 .. D MSG^DDSUTL("Sequence numbers must be consecutive numbers starting with 1.")
71 Q
72 ;
73NAMEPAC ;Post-Action on Change for Name of Key
74 N DIKKSD,DIKKUI
75 ;
76 S DIKKUI=$$GET^DDSVAL(.31,DA,3) Q:'DIKKUI
77 S DIKKSD=$$GET^DDSVAL(.11,DIKKUI,.11)
78 Q:DIKKSD'?1"Uniqueness Index for Key '"1A1"'".E
79 ;
80 S $E(DIKKSD,27)=X
81 D PUT^DDSVAL(.11,DIKKUI,.11,DIKKSD)
82 Q
Note: See TracBrowser for help on using the repository browser.