[613] | 1 | FSCLMPOS ;SLC/STAFF-NOIS List Manager Protocol Other Sort ;4/22/94 11:06
|
---|
| 2 | ;;1.1;NOIS;;Sep 06, 1998
|
---|
| 3 | ;
|
---|
| 4 | SORT ; from FSCLMP
|
---|
| 5 | I ^TMP("FSC LIST CALLS",$J)'>1 Q
|
---|
| 6 | N CNT,DIC,DIR,DONE,LASTCNT,NUM,OK,SORT,X,Y K DIC,DIR,SORT,Y
|
---|
| 7 | S CNT=0,OK=1,DIC=7107.2,DIC(0)="AEMOQZ",DIC("S")="I $P(^(0),U,3)'[""W"",'$D(SORT(""N"",$P(^(0),U)))",DIC("A")="Sort by: "
|
---|
| 8 | S DONE=0 F D I DONE Q
|
---|
| 9 | .D ^DIC
|
---|
| 10 | .I $D(DUOUT)!$D(DTOUT) S DONE=1,OK=0 Q
|
---|
| 11 | .I Y<1 S DONE=1 Q
|
---|
| 12 | .S CNT=CNT+1,SORT(CNT)=Y(0),SORT("N",$P(Y,U,2))=""
|
---|
| 13 | .I CNT>4 S DONE=1 W !,"Limit of 5 fields only."
|
---|
| 14 | .I CNT=1 S DIC("A")="and then sort by: "
|
---|
| 15 | K DIC,SORT("N"),Y
|
---|
| 16 | I 'OK Q
|
---|
| 17 | I '$O(SORT(0)) Q
|
---|
| 18 | W !!,"The list will be sorted by:",!
|
---|
| 19 | S (LASTCNT,CNT)=0 F S CNT=$O(SORT(CNT)) Q:CNT<1 S LASTCNT=CNT W CNT,") ",$P(SORT(CNT),U,2),$S($O(SORT(CNT)):", ",1:"")
|
---|
| 20 | S DIR(0)="LAO^1:"_LASTCNT
|
---|
| 21 | S DIR("A")="Select any fields to be sorted in descending order or <return>: "
|
---|
| 22 | S DIR("?",1)="Descending order will sort from Z to A or highest value first."
|
---|
| 23 | S DIR("?",2)="This is useful for sorting most recent dates first or"
|
---|
| 24 | S DIR("?",3)="numeric value fields. Enter any of the sequence numbers of"
|
---|
| 25 | S DIR("?",4)="the fields you have selected to sort by. (ex. 1,3-4)"
|
---|
| 26 | S DIR("?",5)="If you want all fields sorted in ascending order, enter <return>."
|
---|
| 27 | S DIR("?",6)="Enter '^' to exit without sorting or '??' for more help."
|
---|
| 28 | S DIR("?")="^D HELP^FSCU(.DIR)"
|
---|
| 29 | S DIR("??")="FSC U1 NOIS"
|
---|
| 30 | D ^DIR K DIR
|
---|
| 31 | I $D(DIRUT),Y'="" Q
|
---|
| 32 | F CNT=1:1 S NUM=$P(Y,",",CNT) Q:NUM<1 S SORT(NUM,"D")=""
|
---|
| 33 | D SORT^FSCUS(.SORT)
|
---|
| 34 | Q
|
---|