source: FOIAVistA/trunk/r/SURVEY_GENERATOR-QAP/QAPCHX1.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 3.7 KB
Line 
1QAPCHX1 ;557/THM-EDITING OF ANSWERS [ 07/12/95 7:11 AM ]
2 ;;2.0;Survey Generator;;Jun 20, 1995
3 ;
4 ;called from QAPEDI1
5 ;
6USINPT ;multiple choice
7 K ANS,QANS,STOP
8 S ANSTYPE=$P(^QA(748.25,SURVEY,1,QNAME,0),U,3),GRADIENT=$P(^(0),U,4)
9 S INSERT=$S(ANSTYPE="a":"letter",1:"number"),CNTA=0
10 I "^a^n^"[ANSTYPE F QANS=0:0 S QANS=$O(^QA(748.25,SURVEY,1,QNAME,3,QANS)) Q:QANS=""!(+QANS=0) S CNTA=CNTA+1,ANS($S(ANSTYPE="a":$C(CNTA+96),1:CNTA))=$P(^QA(748.25,SURVEY,1,QNAME,3,QANS,0),U)
11 ;Likert scale
12 I ANSTYPE="l" D LIKRTLAB^QAPCHX K QANS
13 ;
14DIS I ANSTYPE'="l" W !! DO
15 .S (X,Y,CNTA)=0 F S X=$O(ANS(X)) Q:X="" S CNTA=CNTA+1 ;count answers
16 .S REM=CNTA#2,CNTA=(CNTA\2)+REM
17 .F XX=1:1:CNTA S X=XX S:ANSTYPE="a" X=$C(X+96) W X,". ",ANS(X) S:ANSTYPE="a" X=$C($A(X)+CNTA) S:ANSTYPE'="a" X=X+CNTA W:$D(ANS(X)) ?40,X,". ",ANS(X),!
18 I $D(REM),REM>0 W !
19 ;
20A1 S DA(1)=FILEDA,PRESPON=$P(^QA(748.3,DA(1),1,QUES,0),U,2)
21 S:PRESPON=" " PRESPON="Question skipped"
22 W !?5,"Previous response: ",PRESPON,! S QLINE=$S(ACTION="I":$Y+1,1:$Y) W !
23A1A W ?5,"Enter the ",INSERT," of your response: "_$S(PRESPON["skipped":"",1:PRESPON_"// ")
24 R ANSW:DTIME S:'$T STOP=1 S:ANSW[U QAPOUT=1 Q:QAPOUT=1!($D(STOP))
25 I ANSTYPE="a" S ANSW=$TR(ANSW,"ABCDEFGHIJKLMNOPQRSTUVWXYZ ","abcdefghijklmnopqrstuvwxyz")
26 I ANSW="" Q
27 I '$D(ANS(ANSW)) W *7,!!,"You must enter a ",$S(ANSTYPE="a":"letter",1:"number")," from the selection given. " H 2 X CLEOP1 G A1A
28 ;
29A2 K DR S (DIC,DIE)="^QA(748.3,DA(1),1,",DA=QUES,DIC(0)="NM",DR="1////"_ANSW D ^DIE
30 K ANS,ANSW,INSERT,DIC,DIE,X
31 Q
32 ;
33QAYN ;yes/no/na
34 K STOP S DA(1)=FILEDA W !! S PRESPON=$P(^QA(748.3,DA(1),1,QUES,0),U,2)
35 S PRESPON=$S(PRESPON="Y":"Yes",PRESPON="N":"No",PRESPON="NA":"Not applicable",1:"Question skipped")
36 W ?5,"Previous response: ",PRESPON,! S QLINE=$S(ACTION="I":$Y+1,1:$Y) W !
37 ;
38QAYNA W ?5,"Enter Yes, No, or Not applicable (Y/N/NA): "_$S(PRESPON["skipped":"",1:PRESPON_"// ") R ANSW:DTIME S:'$T STOP=1 S:ANSW[U QAPOUT=1 Q:QAPOUT=1!($D(STOP))
39 S ANSW=$TR(ANSW,"any ","ANY"),ANSW=$E(ANSW,1,2)
40 I ANSW="" Q
41 I ANSW'="N",ANSW'="Y",ANSW'="NA" W *7 W !!,"Enter Y for Yes or N for No or NA for not applicable. " H 2 X CLEOP1 G QAYNA
42 ;
43B2 K DR S DA(1)=FILEDA,(DIC,DIE)="^QA(748.3,DA(1),1,",DA=QUES,DIC(0)="NM",DR="1////"_ANSW D ^DIE
44 K ANSW,DIC,DIE,X
45 Q
46 ;
47QATF ;true/false/na
48 K STOP S DA(1)=FILEDA W !! S PRESPON=$P(^QA(748.3,DA(1),1,QUES,0),U,2)
49 S PRESPON=$S(PRESPON="T":"True",PRESPON="NA":"Not applicable",PRESPON="F":"False",1:"Question skipped")
50 W ?5,"Previous response: ",PRESPON,! S QLINE=$S(ACTION="I":$Y+1,1:$Y) W !
51 ;
52QATFA W ?10,"True, False, or NA (T/F/NA): "_$S(PRESPON["skipped":"",1:PRESPON_"// ")
53 R ANSW:DTIME S:'$T STOP=1 S:ANSW[U QAPOUT=1 Q:QAPOUT=1!($D(STOP))
54 S ANSW=$TR(ANSW,"anft ","ANFT"),ANSW=$E(ANSW,1,2)
55 I ANSW="" S ANSW=" " Q
56 I ANSW'="T",ANSW'="F",ANSW'="NA" W *7,!!,"Enter T for True, F for False, or NA for not applicable." H 2 X CLEOP1 G QATFA
57 ;
58 ;file answer
59C2 K DR S DA(1)=FILEDA,(DIC,DIE)="^QA(748.3,DA(1),1,",DA=QUES,DIC(0)="NM",DR="1////"_ANSW D ^DIE
60 K ANSW,DIC,DIE,X
61 Q
62 ;
63WP ;wp response
64 S QAPEDTR=$P($G(^VA(200,+DUZ,1)),U,5),QAPEDTR=$S(QAPEDTR=2:"SCREENMAN",1:"LINE EDITOR") ;see which wp editor they use
65 W !! S QLINE=$Y
66WP1 W "This will be a word processing response.",!!,"Press RETURN to enter a response,",!?6,"^ to skip response entry or Q to QUIT RETURN// " R ANS:DTIME I '$T S QAPOUT=1 Q
67 I ANS["?" X CLEOP1 W " ^ will skip entering any response to this question",!," RETURN will allow you to enter a response",!," Q will allow you to abort or suspend",!!,"Press RETURN " R ANS:DTIME S:'$T QAPOUT=1 Q:'$T X CLEOP1 G WP1
68 I ANS[U Q
69 S ANS=$TR(ANS,"q","Q") I ANS="Q" S QAPOUT=1 Q
70 I QAPEDTR'["SCREENMAN" W @IOF,!
71 K DR S DA(1)=FILEDA,(DIC,DIE)="^QA(748.3,DA(1),1,",DA=QUES,DIC(0)="NM",DR=2 D ^DIE
72 K DIC,DIE,X,QAPEDTR
73 W @IOF,! X QAPBAR
74 Q
Note: See TracBrowser for help on using the repository browser.