source: FOIAVistA/trunk/r/NOIS-FSC/FSCQSS.m@ 1446

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

initial load of FOIAVistA 6/30/08 version

File size: 6.0 KB
Line 
1FSCQSS ;SLC/STAFF-NOIS Query Search Setup ;8/18/98 12:07
2 ;;1.1;NOIS;;Sep 06, 1998
3 ;
4SETUP ; from FSCQS
5 N COND,FFSEQ,FIELD,FQUERY,FSEQ,NODE,VALUE
6 S FSEQ=+$O(CRITERIA("O",0)),STEP=+CRITERIA("O",FSEQ)
7 S FFSEQ=+$O(CRITERIA("O",FSEQ,0)),FQUERY=+CRITERIA("O",FSEQ,FFSEQ)
8 S QUERY=CRITERIA(STEP,FQUERY)
9 F S FFSEQ=$O(CRITERIA("O",FSEQ,FFSEQ)) Q:FFSEQ<1 S FQUERY=+CRITERIA("O",FSEQ,FFSEQ) D
10 .S FQUERY=CRITERIA(STEP,FQUERY)
11 .S FIELD=$P(FQUERY,U),COND=$P(FQUERY,U,2),VALUE=$P(FQUERY,U,3)
12 .I "PND"'[$E(CRITERIA("F",FIELD)) S VALUE=""""_$$UP^XLFSTR(VALUE)_""""
13 .I $P(CRITERIA("F",FIELD),U)="W" D Q
14 ..S VALUE=$E(VALUE,2,$L(VALUE)-1) D QUOTES(.VALUE)
15 ..I FIELD=59 D PERWP Q
16 ..I COND="[" D Q
17 ...S CRITERIA("O",FSEQ,"AND",FFSEQ)="N GOOD,LINE1,SUBNUM I 1"
18 ...S CRITERIA("O",FSEQ,"AND",FFSEQ+.1)="S LINE1=""F S SUBNUM=$O(^FSCD(""""CALL"""",CALL,"_$S(FIELD=12:30,FIELD=13:50,FIELD=43:110,FIELD=54:103,1:80)_",SUBNUM)) Q:SUBNUM<1 I $$UP^XLFSTR($G(^(SUBNUM,0)))["_VALUE_" S GOOD=1 Q"" I 1"
19 ...S CRITERIA("O",FSEQ,"AND",FFSEQ+.2)="S (GOOD,SUBNUM)=0 X LINE1 I GOOD"
20 ..I COND="exists" S CRITERIA("O",FSEQ,"AND",FFSEQ)="I $O(^FSCD(""CALL"",CALL,"_$S(FIELD=12:30,FIELD=13:50,FIELD=43:110,FIELD=54:103,1:80)_",0))" Q
21 ..I COND="'[" D Q
22 ...S CRITERIA("O",FSEQ,"AND",FFSEQ)="N LINE1,GOOD,SUBNUM I 1"
23 ...S CRITERIA("O",FSEQ,"AND",FFSEQ+.1)="I $O(^FSCD(""CALL"",CALL,"_$S(FIELD=12:30,FIELD=13:50,FIELD=43:110,FIELD=54:103,1:80)_",0))"
24 ...S CRITERIA("O",FSEQ,"AND",FFSEQ+.2)="S LINE1=""F S SUBNUM=$O(^FSCD(""""CALL"""",CALL,"_$S(FIELD=12:30,FIELD=13:50,FIELD=43:110,FIELD=54:103,1:80)_",SUBNUM)) Q:SUBNUM<1 I $$UP^XLFSTR($G(^(SUBNUM,0)))["_VALUE_" S GOOD=1 Q"" I 1"
25 ...S CRITERIA("O",FSEQ,"AND",FFSEQ+.3)="S (GOOD,SUBNUM)=0 X LINE1 I 'GOOD"
26 ..I COND="not exists" S CRITERIA("O",FSEQ,"AND",FFSEQ)="I '$O(^FSCD(""CALL"",CALL,"_$S(FIELD=12:30,FIELD=13:50,FIELD=43:110,FIELD=54:103,1:80)_",0))" Q
27 .S NODE=$P(CRITERIA("F",FIELD),U,2)
28 .I NODE["7100.6," D PER Q
29 .I NODE[";",$E(NODE,1,2)'="1;" D Q
30 ..S CRITERIA("O",FSEQ,"AND",1+(NODE*.00001))="S X("_+NODE_")=$G(^FSCD(""CALL"",CALL,"_+NODE_")) I 1"
31 ..I COND["exist" D Q
32 ...I COND="exists" S CRITERIA("O",FSEQ,"AND",FFSEQ)="I $L($P(X("_+NODE_"),U,"_+$P(NODE,";",2)_"))" Q
33 ...I COND="not exists" S CRITERIA("O",FSEQ,"AND",FFSEQ)="I '$L($P(X("_+NODE_"),U,"_+$P(NODE,";",2)_"))" Q
34 ..I COND["range" D Q
35 ...S CRITERIA("O",FSEQ,"AND",FFSEQ+.1)="S X(""BEG"")="""_$P(VALUE,"-")_""",X(""END"")="""_$P(VALUE,"-",2)_""" I X(""BEG"")=+X(""BEG""),X(""END"")=+X(""END"")"
36 ...I COND="range" S CRITERIA("O",FSEQ,"AND",FFSEQ+.2)="I $P(X("_+NODE_"),U,"_+$P(NODE,";",2)_")'<X(""BEG""),$P(X("_+NODE_"),U,"_+$P(NODE,";",2)_")'>X(""END"")"
37 ...I COND="not range" S CRITERIA("O",FSEQ,"AND",FFSEQ+.2)="I $P(X("_+NODE_"),U,"_+$P(NODE,";",2)_")<X(""BEG"")!($P(X("_+NODE_"),U,"_+$P(NODE,";",2)_")>X(""END""))"
38 ..S CRITERIA("O",FSEQ,"AND",FFSEQ)="I $$UP^XLFSTR($P(X("_+NODE_"),U,"_+$P(NODE,";",2)_"))"_COND_VALUE
39 .I $E(NODE,1,2)="1;" D Q
40 ..S CRITERIA("O",FSEQ,"AND",1.1)="S Y=$G(^FSCD(""CALL"",CALL,1)) I 1"
41 ..I COND["exist" D Q
42 ...I COND="exists" S CRITERIA("O",FSEQ,"AND",FFSEQ)="I $L(Y)" Q
43 ...I COND="not exists" S CRITERIA("O",FSEQ,"AND",FFSEQ)="I '$L(Y)" Q
44 ..S CRITERIA("O",FSEQ,"AND",FFSEQ)="I $$UP^XLFSTR(Y)"_COND_VALUE
45 S CRITERIA("O",FSEQ,"AND",1+$O(CRITERIA("O",FSEQ,"A"),-1))="S ^TMP(""FSC NEWLIST"",$J,CALL)="""""
46 Q
47 ;
48PERWP ;
49 I COND="[" D Q
50 .S CRITERIA("O",FSEQ,"AND",FFSEQ)="N GOOD,IEN,LINE1,SUBNUM I 1"
51 .S CRITERIA("O",FSEQ,"AND",FFSEQ+.1)="S IEN=+$G(^FSCD(""CALL USER"",""AUC"",DUZ,CALL)) I IEN"
52 .S CRITERIA("O",FSEQ,"AND",FFSEQ+.2)="S LINE1=""F S SUBNUM=$O(^FSCD(""""CALL USER"""",IEN,2,SUBNUM)) Q:SUBNUM<1 I $$UP^XLFSTR($G(^(SUBNUM,0)))["_VALUE_" S GOOD=1 Q"" I 1"
53 .S CRITERIA("O",FSEQ,"AND",FFSEQ+.3)="S (GOOD,SUBNUM)=0 X LINE1 I GOOD"
54 I COND="exists" D Q
55 .S CRITERIA("O",FSEQ,"AND",FFSEQ)="N GOOD,IEN,LINE1,SUBNUM I 1"
56 .S CRITERIA("O",FSEQ,"AND",FFSEQ+.1)="S IEN=+$G(^FSCD(""CALL USER"",""AUC"",DUZ,CALL)) I IEN"
57 .S CRITERIA("O",FSEQ,"AND",FFSEQ+.2)="I $O(^FSCD(""CALL USER"",IEN,2,0))"
58 I COND="'[" D Q
59 .S CRITERIA("O",FSEQ,"AND",FFSEQ)="N GOOD,IEN,LINE1,SUBNUM I 1"
60 .S CRITERIA("O",FSEQ,"AND",FFSEQ+.1)="S IEN=+$G(^FSCD(""CALL USER"",""AUC"",DUZ,CALL)) I IEN"
61 .S CRITERIA("O",FSEQ,"AND",FFSEQ+.2)="I $O(^FSCD(""CALL USER"",IEN,2,0))"
62 .S CRITERIA("O",FSEQ,"AND",FFSEQ+.3)="S LINE1=""F S SUBNUM=$O(^FSCD(""""CALL USER"""",IEN,2,SUBNUM)) Q:SUBNUM<1 I $$UP^XLFSTR($G(^(SUBNUM,0)))["_VALUE_" S GOOD=1 Q"" I 1"
63 .S CRITERIA("O",FSEQ,"AND",FFSEQ+.4)="S (GOOD,SUBNUM)=0 X LINE1 I 'GOOD"
64 I COND="not exists" D Q
65 .S CRITERIA("O",FSEQ,"AND",FFSEQ)="N GOOD,IEN,LINE1,SUBNUM I 1"
66 .S CRITERIA("O",FSEQ,"AND",FFSEQ+.1)="S IEN=+$G(^FSCD(""CALL USER"",""AUC"",DUZ,CALL)) I 1"
67 .S CRITERIA("O",FSEQ,"AND",FFSEQ+.2)="I '$O(^FSCD(""CALL USER"",IEN,2,0))" Q
68 Q
69 ;
70PER ;
71 S NODE=$P(NODE,",",2)
72 S CRITERIA("O",FSEQ,"AND",1+((NODE+5000)*.00001))="S X("_(5000+NODE)_")=$G(^FSCD(""CALL USER"",+$G(^FSCD(""CALL USER"",""AUC"",DUZ,CALL)),"_+NODE_")) I 1"
73 I COND["exist" D Q
74 .I COND="exists" S CRITERIA("O",FSEQ,"AND",FFSEQ)="I $L($P(X("_(5000+NODE)_"),U,"_+$P(NODE,";",2)_"))" Q
75 .I COND="not exists" S CRITERIA("O",FSEQ,"AND",FFSEQ)="I '$L($P(X("_(5000+NODE)_"),U,"_+$P(NODE,";",2)_"))" Q
76 I COND["range" D Q
77 .S CRITERIA("O",FSEQ,"AND",FFSEQ+.1)="S X(""BEG"")="""_$P(VALUE,"-")_""",X(""END"")="""_$P(VALUE,"-",2)_""" I X(""BEG"")=+X(""BEG""),X(""END"")=+X(""END"")"
78 .I COND="range" S CRITERIA("O",FSEQ,"AND",FFSEQ+.2)="I $P(X("_(5000+NODE)_"),U,"_+$P(NODE,";",2)_")'<X(""BEG""),$P(X("_(5000+NODE)_"),U,"_+$P(NODE,";",2)_")'>X(""END"")"
79 .I COND="not range" S CRITERIA("O",FSEQ,"AND",FFSEQ+.2)="I $P(X("_(5000+NODE)_"),U,"_+$P(NODE,";",2)_")<X(""BEG"")!($P(X("_(5000+NODE)_"),U,"_+$P(NODE,";",2)_")>X(""END""))"
80 S CRITERIA("O",FSEQ,"AND",FFSEQ)="I $$UP^XLFSTR($P(X("_(5000+NODE)_"),U,"_+$P(NODE,";",2)_"))"_COND_VALUE
81 Q
82 ;
83QUOTES(VALUE) ; from FSCQSSM
84 N CHAR,CNT,TEMP
85 I VALUE["""" D
86 .S TEMP=""
87 .F CNT=1:1:$L(VALUE) S CHAR=$E(VALUE,CNT) D
88 ..I CHAR="""" S TEMP=TEMP_"""""""""" Q
89 ..S TEMP=TEMP_CHAR
90 .S VALUE=""""""_TEMP_""""""
91 E S VALUE=""""""_VALUE_""""""
92 Q
Note: See TracBrowser for help on using the repository browser.