FSCUX ;SLC/STAFF-NOIS Utilities Expand ;8/25/94 16:17
;;1.1;NOIS;;Sep 06, 1998
;
EXPAND(CHOICE,OK,DEFAULT) ; from FSCLMPC, FSCLMPD, FSCOPT, FSCRPTS
N CNT,DIC,Y K DIC,Y S OK=1
S CHOICE=$S($L($G(DEFAULT)):DEFAULT,1:"BRIEF")
D LOOKUP^FSCULOOK("FTYPE",.CHOICE,"AEMOQZ",.OK,"I '$P(^(0),U,6)")
I $D(DUOUT)!$D(DTOUT) S OK=0,CHOICE=$G(CHOICE) Q
D OTHER(.CHOICE,.OK)
Q
;
OTHER(CHOICE,OK) ; from FSCRPTS
N CNT,D,DIC,FIELD,FORMAT,TYPE,Y K DIC,Y S OK=1
S CHOICE=$P(CHOICE,U,2),TYPE=CHOICE(0)
D
.I $P(TYPE,U,2)="EXECUTE" D Q
..D LOOKUP^FSCULOOK("FORMAT",.FORMAT,"AEMOQ",.OK,"I $D(^(1))")
..S CHOICE("F")=FORMAT,FORMAT=+FORMAT
..I OK D
...S CNT=0 F S CNT=$O(^FSC("FORMAT",FORMAT,2,CNT)) Q:CNT<1 S FIELD=+^(CNT,0) D
....S CHOICE(CNT)=^FSC("FLD",FIELD,0)
.I $P(TYPE,U,3) D Q
..D LOOKUP^FSCULOOK("FORMAT",.FORMAT,"AEMOQ",.OK)
..S FORMAT=+FORMAT
..I OK D
...S CNT=0 F S CNT=$O(^FSC("FORMAT",FORMAT,2,CNT)) Q:CNT<1 S FIELD=+^(CNT,0) D
....S CHOICE(CNT)=^FSC("FLD",FIELD,0)
.I $P(TYPE,U,5) D Q
..S DIC=7107.2,DIC(0)="AEMOQZ",DIC("A")="Select Field: "
..F CNT=1:1 D ^DIC Q:Y<1 S CHOICE(CNT)=Y(0)
..K DIC
.I $P(TYPE,U,2)="FM" D Q
..S DIC="^DIPT(",DIC(0)="AEOQ",DIC("A")="Select Print Template: ",D="F7100"
..D IX^DIC K DIC S:Y<0 OK=0
..S CHOICE("T")="["_$P(Y,U,2)_"]"
I $P(TYPE,U,2)="STAT" D
.N DIC,Y K CHOICE("COLLATE"),DIC,Y,^TMP("FSC STATS",$J)
.I '$O(CHOICE(0)) S OK=0 W !,"No fields selected.",$C(7),! H 1 Q
.I '$O(CHOICE(1)) Q
.S DIC=7107.2,DIC(0)="AEMOQZ",DIC("A")="(Optional) Select a Field to Collate your fields with: "
.D ^DIC K DIC Q:Y<1
.S CNT=0 F S CNT=$O(CHOICE(CNT)) Q:CNT<1 I Y(0)=CHOICE(CNT) S CHOICE("COLLATE")=CNT
.I '$D(CHOICE("COLLATE")) S CNT=1+$O(CHOICE("A"),-1),CHOICE(CNT)=Y(0),CHOICE("COLLATE")=CNT
I $P(TYPE,U,2)="EXTRACT" S CHOICE("E")=""
S CHOICE=$$CHOICE($P(TYPE,U,2))
Q
;
CHOICE(CHOICE) ; $$(choice) -> single letter
Q $S(CHOICE="BRIEF":"B",CHOICE="DETAIL":"D",CHOICE="STAT":"S",CHOICE="FIELD":"C",CHOICE="FORMAT":"C",CHOICE="FM":"FM",1:"F")
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCUX 2058 printed Dec 13, 2024@02:20:31 Page 2
FSCUX ;SLC/STAFF-NOIS Utilities Expand ;8/25/94 16:17
+1 ;;1.1;NOIS;;Sep 06, 1998
+2 ;
EXPAND(CHOICE,OK,DEFAULT) ; from FSCLMPC, FSCLMPD, FSCOPT, FSCRPTS
+1 NEW CNT,DIC,Y
KILL DIC,Y
SET OK=1
+2 SET CHOICE=$SELECT($LENGTH($GET(DEFAULT)):DEFAULT,1:"BRIEF")
+3 DO LOOKUP^FSCULOOK("FTYPE",.CHOICE,"AEMOQZ",.OK,"I '$P(^(0),U,6)")
+4 IF $DATA(DUOUT)!$DATA(DTOUT)
SET OK=0
SET CHOICE=$GET(CHOICE)
QUIT
+5 DO OTHER(.CHOICE,.OK)
+6 QUIT
+7 ;
OTHER(CHOICE,OK) ; from FSCRPTS
+1 NEW CNT,D,DIC,FIELD,FORMAT,TYPE,Y
KILL DIC,Y
SET OK=1
+2 SET CHOICE=$PIECE(CHOICE,U,2)
SET TYPE=CHOICE(0)
+3 Begin DoDot:1
+4 IF $PIECE(TYPE,U,2)="EXECUTE"
Begin DoDot:2
+5 DO LOOKUP^FSCULOOK("FORMAT",.FORMAT,"AEMOQ",.OK,"I $D(^(1))")
+6 SET CHOICE("F")=FORMAT
SET FORMAT=+FORMAT
+7 IF OK
Begin DoDot:3
+8 SET CNT=0
FOR
SET CNT=$ORDER(^FSC("FORMAT",FORMAT,2,CNT))
if CNT<1
QUIT
SET FIELD=+^(CNT,0)
Begin DoDot:4
+9 SET CHOICE(CNT)=^FSC("FLD",FIELD,0)
End DoDot:4
End DoDot:3
End DoDot:2
QUIT
+10 IF $PIECE(TYPE,U,3)
Begin DoDot:2
+11 DO LOOKUP^FSCULOOK("FORMAT",.FORMAT,"AEMOQ",.OK)
+12 SET FORMAT=+FORMAT
+13 IF OK
Begin DoDot:3
+14 SET CNT=0
FOR
SET CNT=$ORDER(^FSC("FORMAT",FORMAT,2,CNT))
if CNT<1
QUIT
SET FIELD=+^(CNT,0)
Begin DoDot:4
+15 SET CHOICE(CNT)=^FSC("FLD",FIELD,0)
End DoDot:4
End DoDot:3
End DoDot:2
QUIT
+16 IF $PIECE(TYPE,U,5)
Begin DoDot:2
+17 SET DIC=7107.2
SET DIC(0)="AEMOQZ"
SET DIC("A")="Select Field: "
+18 FOR CNT=1:1
DO ^DIC
if Y<1
QUIT
SET CHOICE(CNT)=Y(0)
+19 KILL DIC
End DoDot:2
QUIT
+20 IF $PIECE(TYPE,U,2)="FM"
Begin DoDot:2
+21 SET DIC="^DIPT("
SET DIC(0)="AEOQ"
SET DIC("A")="Select Print Template: "
SET D="F7100"
+22 DO IX^DIC
KILL DIC
if Y<0
SET OK=0
+23 SET CHOICE("T")="["_$PIECE(Y,U,2)_"]"
End DoDot:2
QUIT
End DoDot:1
+24 IF $PIECE(TYPE,U,2)="STAT"
Begin DoDot:1
+25 NEW DIC,Y
KILL CHOICE("COLLATE"),DIC,Y,^TMP("FSC STATS",$JOB)
+26 IF '$ORDER(CHOICE(0))
SET OK=0
WRITE !,"No fields selected.",$CHAR(7),!
HANG 1
QUIT
+27 IF '$ORDER(CHOICE(1))
QUIT
+28 SET DIC=7107.2
SET DIC(0)="AEMOQZ"
SET DIC("A")="(Optional) Select a Field to Collate your fields with: "
+29 DO ^DIC
KILL DIC
if Y<1
QUIT
+30 SET CNT=0
FOR
SET CNT=$ORDER(CHOICE(CNT))
if CNT<1
QUIT
IF Y(0)=CHOICE(CNT)
SET CHOICE("COLLATE")=CNT
+31 IF '$DATA(CHOICE("COLLATE"))
SET CNT=1+$ORDER(CHOICE("A"),-1)
SET CHOICE(CNT)=Y(0)
SET CHOICE("COLLATE")=CNT
End DoDot:1
+32 IF $PIECE(TYPE,U,2)="EXTRACT"
SET CHOICE("E")=""
+33 SET CHOICE=$$CHOICE($PIECE(TYPE,U,2))
+34 QUIT
+35 ;
CHOICE(CHOICE) ; $$(choice) -> single letter
+1 QUIT $SELECT(CHOICE="BRIEF":"B",CHOICE="DETAIL":"D",CHOICE="STAT":"S",CHOICE="FIELD":"C",CHOICE="FORMAT":"C",CHOICE="FM":"FM",1:"F")