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

FSCQSSM.m

Go to the documentation of this file.
FSCQSSM ;SLC/STAFF-NOIS Query Search Setup Multiple ;8/18/98  11:59
 ;;1.1;NOIS;;Sep 06, 1998
 ;
SETUP ; from FSCQS
 N FSEQ,FFSEQ,FQUERY,FIELD,COND,VALUE,NODE
 S FSEQ=0 F  S FSEQ=$O(CRITERIA("O",FSEQ)) Q:FSEQ<1  D
 .S STEP=+CRITERIA("O",FSEQ)
 .S FFSEQ=0 F  S FFSEQ=$O(CRITERIA("O",FSEQ,FFSEQ)) Q:FFSEQ<1  S FQUERY=+CRITERIA("O",FSEQ,FFSEQ) D
 ..S FQUERY=CRITERIA(STEP,FQUERY)
 ..S FIELD=$P(FQUERY,U),COND=$P(FQUERY,U,2),VALUE=$P(FQUERY,U,3)
 ..I "PND"'[$E(CRITERIA("F",FIELD)) S VALUE=""""_$$UP^XLFSTR(VALUE)_""""
 ..I $P(CRITERIA("F",FIELD),U)="W" D  Q
 ...S VALUE=$E(VALUE,2,$L(VALUE)-1) D QUOTES^FSCQSS(.VALUE)
 ...I FIELD=59 D PERWP Q
 ...I COND="[" D  Q
 ....S CRITERIA("O",FSEQ,"AND",FFSEQ+1)="N LINE1,GOOD,SUBNUM I 1"
 ....S CRITERIA("O",FSEQ,"AND",FFSEQ+1.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"
 ....S CRITERIA("O",FSEQ,"AND",FFSEQ+1.2)="S (GOOD,SUBNUM)=0 X LINE1 I GOOD"
 ...I COND="exists" 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))" Q
 ...I COND="'[" D  Q
 ....S CRITERIA("O",FSEQ,"AND",FFSEQ+1)="N LINE1,GOOD,SUBNUM I 1"
 ....S CRITERIA("O",FSEQ,"AND",FFSEQ+1.1)="I $O(^FSCD(""CALL"",CALL,"_$S(FIELD=12:30,FIELD=13:50,FIELD=43:110,FIELD=54:103,1:80)_",0))"
 ....S CRITERIA("O",FSEQ,"AND",FFSEQ+1.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"
 ....S CRITERIA("O",FSEQ,"AND",FFSEQ+1.3)="S (GOOD,SUBNUM)=0 X LINE1 I 'GOOD"
 ...I COND="not exists" 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))" Q
 ..S NODE=$P(CRITERIA("F",FIELD),U,2)
 ..I NODE["7100.6," D PER Q
 ..I NODE[";",$E(NODE,1,2)'="1;" D  Q
 ...S CRITERIA("O",+$O(CRITERIA("O",0)),"AND",1+(NODE*.00001))="S X("_+NODE_")=$G(^FSCD(""CALL"",CALL,"_+NODE_")) I 1"
 ...I COND["exist" D  Q
 ....I COND="exists" S CRITERIA("O",FSEQ,"AND",FFSEQ+1)="I $L($P(X("_+NODE_"),U,"_+$P(NODE,";",2)_"))" Q
 ....I COND="not exists" S CRITERIA("O",FSEQ,"AND",FFSEQ+1)="I '$L($P(X("_+NODE_"),U,"_+$P(NODE,";",2)_"))" Q
 ...I COND["range" D  Q
 ....S CRITERIA("O",FSEQ,"AND",FFSEQ+1.1)="S X(""BEG"")="""_$P(VALUE,"-")_""",X(""END"")="""_$P(VALUE,"-",2)_""" I X(""BEG"")=+X(""BEG""),X(""END"")=+X(""END"")"
 ....I COND="range" S CRITERIA("O",FSEQ,"AND",FFSEQ+1.2)="I $P(X("_+NODE_"),U,"_+$P(NODE,";",2)_")'<X(""BEG""),$P(X("_+NODE_"),U,"_+$P(NODE,";",2)_")'>X(""END"")"
 ....I COND="not range" S CRITERIA("O",FSEQ,"AND",FFSEQ+1.2)="I $P(X("_+NODE_"),U,"_+$P(NODE,";",2)_")<X(""BEG"")!($P(X("_+NODE_"),U,"_+$P(NODE,";",2)_")>X(""END""))"
 ...S CRITERIA("O",FSEQ,"AND",FFSEQ+1)="I $$UP^XLFSTR($P(X("_+NODE_"),U,"_+$P(NODE,";",2)_"))"_COND_VALUE
 ..I $E(NODE,1,2)="1;" D  Q
 ...S CRITERIA("O",FSEQ,"AND",1.1)="S Y=$G(^FSCD(""CALL"",CALL,1)) I 1"
 ...I COND["exist" D  Q
 ....I COND="exists" S CRITERIA("O",FSEQ,"AND",FFSEQ+1)="I $L(Y)" Q
 ....I COND="not exists" S CRITERIA("O",FSEQ,"AND",FFSEQ+1)="I '$L(Y)" Q
 ...S CRITERIA("O",FSEQ,"AND",FFSEQ+1)="I $$UP^XLFSTR(Y)"_COND_VALUE
 .S CRITERIA("O",FSEQ,"AND",2+$O(CRITERIA("O",FSEQ,"A"),-1))="S ^TMP(""FSC NEWLIST"",$J,CALL)="""""
 Q
 ;
PERWP ;
 I COND="[" D  Q
 .S CRITERIA("O",FSEQ,"AND",FFSEQ+1)="N GOOD,IEN,LINE1,SUBNUM I 1"
 .S CRITERIA("O",FSEQ,"AND",FFSEQ+1.1)="S IEN=+$G(^FSCD(""CALL USER"",""AUC"",DUZ,CALL)) I IEN"
 .S CRITERIA("O",FSEQ,"AND",FFSEQ+1.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"
 .S CRITERIA("O",FSEQ,"AND",FFSEQ+1.3)="S (GOOD,SUBNUM)=0 X LINE1 I GOOD"
 I COND="exists" D  Q
 .S CRITERIA("O",FSEQ,"AND",FFSEQ+1)="N GOOD,IEN,LINE1,SUBNUM I 1"
 .S CRITERIA("O",FSEQ,"AND",FFSEQ+1.1)="S IEN=+$G(^FSCD(""CALL USER"",""AUC"",DUZ,CALL)) I IEN"
 .S CRITERIA("O",FSEQ,"AND",FFSEQ+1.2)="I $O(^FSCD(""CALL USER"",IEN,2,0))"
 I COND="'[" D  Q
 .S CRITERIA("O",FSEQ,"AND",FFSEQ+1)="N GOOD,IEN,LINE1,SUBNUM I 1"
 .S CRITERIA("O",FSEQ,"AND",FFSEQ+1.1)="S IEN=+$G(^FSCD(""CALL USER"",""AUC"",DUZ,CALL)) I IEN"
 .S CRITERIA("O",FSEQ,"AND",FFSEQ+1.2)="I $O(^FSCD(""CALL USER"",IEN,2,0))"
 .S CRITERIA("O",FSEQ,"AND",FFSEQ+1.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"
 .S CRITERIA("O",FSEQ,"AND",FFSEQ+1.4)="S (GOOD,SUBNUM)=0 X LINE1 I 'GOOD"
 I COND="not exists" D  Q
 .S CRITERIA("O",FSEQ,"AND",FFSEQ+1)="N GOOD,IEN,LINE1,SUBNUM I 1"
 .S CRITERIA("O",FSEQ,"AND",FFSEQ+1.1)="S IEN=+$G(^FSCD(""CALL USER"",""AUC"",DUZ,CALL)) I 1"
 .S CRITERIA("O",FSEQ,"AND",FFSEQ+1.2)="I '$O(^FSCD(""CALL USER"",IEN,2,0))" Q
 Q
 ;
PER ;
 S NODE=$P(NODE,",",2)
 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"
 I COND["exist" D  Q
 .I COND="exists" S CRITERIA("O",FSEQ,"AND",FFSEQ+1)="I $L($P(X("_(5000+NODE)_"),U,"_+$P(NODE,";",2)_"))" Q
 .I COND="not exists" S CRITERIA("O",FSEQ,"AND",FFSEQ+1)="I '$L($P(X("_(5000+NODE)_"),U,"_+$P(NODE,";",2)_"))" Q
 I COND["range" D  Q
 .S CRITERIA("O",FSEQ,"AND",FFSEQ+1.1)="S X(""BEG"")="""_$P(VALUE,"-")_""",X(""END"")="""_$P(VALUE,"-",2)_""" I X(""BEG"")=+X(""BEG""),X(""END"")=+X(""END"")"
 .I COND="range" S CRITERIA("O",FSEQ,"AND",FFSEQ+1.2)="I $P(X("_(5000+NODE)_"),U,"_+$P(NODE,";",2)_")'<X(""BEG""),$P(X("_(5000+NODE)_"),U,"_+$P(NODE,";",2)_")'>X(""END"")"
 .I COND="not range" S CRITERIA("O",FSEQ,"AND",FFSEQ+1.2)="I $P(X("_(5000+NODE)_"),U,"_+$P(NODE,";",2)_")<X(""BEG"")!($P(X("_(5000+NODE)_"),U,"_+$P(NODE,";",2)_")>X(""END""))"
 S CRITERIA("O",FSEQ,"AND",FFSEQ+1)="I $$UP^XLFSTR($P(X("_(5000+NODE)_"),U,"_+$P(NODE,";",2)_"))"_COND_VALUE
 Q
 ;