| 1 | ONCOSINP ;WASH ISC/SRR,MLH-INPUT SUBROUTINES FOR ONCOS ;11/1/93  12:16 | 
|---|
| 2 | ;;2.11;ONCOLOGY;;Mar 07, 1995 | 
|---|
| 3 | ;These entry points perform miscellaneous input functions: | 
|---|
| 4 | ;GETFILE  get a FileMan file | 
|---|
| 5 | ;GETYES   get a yes/no response | 
|---|
| 6 | ;GETTEMPL get a search template | 
|---|
| 7 | ; | 
|---|
| 8 | GETFILE ;lookup file, get file number & global reference | 
|---|
| 9 | ;in:  ONCOS("F")=file name | 
|---|
| 10 | ;out: ONCOS("FI")=file number^file name^global reference OR Y=-1 | 
|---|
| 11 | N DIC | 
|---|
| 12 | S X=$S($D(ONCOS("F")):ONCOS("F"),1:""),DIC="^DIC(",DIC(0)=$S(X="":"AEQ",1:"EQ") D ^DIC Q:Y<0  S GBL=^DIC(+Y,0,"GL"),FNUM=+Y,ONCOS("FI")=Y_GBL W !,"FILE: ",X Q | 
|---|
| 13 | Q | 
|---|
| 14 | ; | 
|---|
| 15 | GETTEMPL ;get a search template | 
|---|
| 16 | ;in:  FNUM,ONCOS,^DIBT | 
|---|
| 17 | ;out: Y | 
|---|
| 18 | N D,DIC,DIR | 
|---|
| 19 | I $D(ONCOS("T")) S Y=ONCOS("T") Q:Y="ALL"  I $D(^DIBT("F"_FNUM,Y)) S X=$O(^(Y,"")) I X]"" W !,"SEARCH TEMPLATE: ",Y S Y=X_U_Y Q | 
|---|
| 20 | ;S Y="Use a SEARCH TEMPLATE? Yes// ",Z="Use a SEARCH TEMPLATE to restrict cases" | 
|---|
| 21 | ASK W ! S DIR("A")="     Restrict cases with a SEARCH TEMPLATE",DIR("B")="Yes",DIR(0)="Y",DIR("??")="^D HP1^ONCOSINP" D ^DIR G GT2:$G(Y)=0 S Y=$S(Y["^":-1,Y="":0,1:1) Q:Y'>0  G GT2:Y=2 | 
|---|
| 22 | Z S D="F"_FNUM,DIC="^DIBT(",DIC(0)="AEQ",DIC("A")="     Select SEARCH TEMPLATE: " D ^DIC S Y=$S(Y="^":0,Y="":0,Y=-1:0,1:Y) Q:'Y  S N=+Y | 
|---|
| 23 | X ;D GETYES E  Q:Y=-1  G GT2 | 
|---|
| 24 | I '$D(^DIBT(N,"DIS")) W !,"Sorry, ",$P(Y,U,2)," must be a SEARCH template" G GT1 | 
|---|
| 25 | I '$D(^DIBT(N,1)) W !!,?10,$P(Y,U,2)_" does not have stored entries",!?10,"you must run FM Search Option for this template.",!! G GT1 | 
|---|
| 26 | W !!?10,"REMINDER: Run Define Search Criteria Option" | 
|---|
| 27 | W !,?10,"to be sure selected entries are up-to-date!!",! | 
|---|
| 28 | ;S DIR("A")="Continue",DIR(0)="Y",DIR("B")="Yes" D ^DIR W ! S Y=$S(Y=1:1,1:0) | 
|---|
| 29 | ;Line above caused program to quit with NO DEATHS | 
|---|
| 30 | Q | 
|---|
| 31 | Q | 
|---|
| 32 | GT2 W ! S Y="Really use ALL cases (this may take some time)? No// ",Z="" | 
|---|
| 33 | D GETYES I  S Y="ALL" | 
|---|
| 34 | E  G:Y'=-1 ASK | 
|---|
| 35 | Q | 
|---|
| 36 | HP1 W !!?10,"Using a Search Template will restrict cases.",! | 
|---|
| 37 | W ?10,"It will act as a filter using only those cases",! | 
|---|
| 38 | W ?10,"that fit the criteria you have selected." | 
|---|
| 39 | W W !!,?10,"YOU MUST have FIRST GENERATED the Search Template using the",!?10,"DS Option to create the necessary 'TRUE' entries!",!! | 
|---|
| 40 | Q | 
|---|
| 41 | GT1 S D="F"_FNUM D IX^DIC G GT2:$P(Y,U,2)="ALL" Q:Y=-1  Q:$O(^DIBT(+Y,1,""))]"" | 
|---|
| 42 | Q | 
|---|
| 43 | ; | 
|---|
| 44 | GETYES ;get a yes/no response | 
|---|
| 45 | ;in:  Y = prompt (including default e.g. Yes//) | 
|---|
| 46 | ;     Z = undefined if specific help handled by calling module | 
|---|
| 47 | ;       '="" for single line help | 
|---|
| 48 | ;out: X = actual entry | 
|---|
| 49 | ;     $T = true if yes | 
|---|
| 50 | ;     Y = -1 for ^ | 
|---|
| 51 | W !,Y R X:DTIME E  S X="^" | 
|---|
| 52 | I X'[U | 
|---|
| 53 | E  S Y=-1 Q | 
|---|
| 54 | I X="" S X=$F(Y,"//"),X=$S(X>3:$E(Y,X-5,X-3),1:"?") | 
|---|
| 55 | I '(X["Y"!(X["y")!(X["N")!(X["n")) W *7 S X="?" | 
|---|
| 56 | I X["?" W !,"Enter 'y' or 'n' or '^' to abort." Q:'$D(Z)  W:Z'="" !,Z G GETYES | 
|---|
| 57 | I X["Y"!(X["y") W "  (Yes)" | 
|---|
| 58 | E  W "  (No)" | 
|---|
| 59 | Q | 
|---|