Changeset 121 for ccr/trunk


Ignore:
Timestamp:
Aug 30, 2008, 1:29:46 PM (16 years ago)
Author:
George Lilly
Message:

XINDEX fixes, and generalized Date sort utility for Vitals SORTDTCCRUTIL

Location:
ccr/trunk/p
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • ccr/trunk/p/CCRUTIL.m

    r120 r121  
    1818 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    1919    ;
    20           W "No Entry at Top!" Q
    21 
     20          W "No Entry at Top!"
     21          Q
     22          ;
    2223FMDTOUTC(DATE,FORMAT) ; Convert Fileman Date to UTC Date Format; PUBLIC; Extrinsic
    2324          ; FORMAT is Format of Date. Can be either D (Day) or DT (Date and Time)
     
    4748          E  Q $P(UTC,"T")
    4849          ;
     50SORTDT(V1,V2,ORDR) ; DATE SORT ARRAY AND RETURN INDEX IN V1 AND COUNT
     51               ; AS EXTRINSIC ORDR IS 1 OR -1 FOR FORWARD OR REVERSE
     52               ; DATE AND TIME ORDER. DEFAULT IS FORWARD
     53               ; V2 IS AN ARRAY OF DATES IN FILEMAN FORMAT
     54               ; V1 IS RETURNS INDIRECT INDEXES OF V2 IN REVERSE DATE ORDER
     55               ; SO V2(V1(X)) WILL RETURN THE DATES IN DATE/TIME ORDER
     56               ; THE COUNT OF THE DATES IS RETURNED AS AN EXTRINSIC
     57               ; BOTH V1 AND V2 ARE PASSED BY REFERENCE
     58          N VSRT ; TEMP FOR HASHING DATES
     59          N ZI,ZJ,ZTMP,ZCNT,ZP1,ZP2
     60          S ZCNT=0 ; COUNTING NUMBER OF DATES
     61          S ZTMP="" ;
     62          F ZI=0:0 D  Q:$O(V2(ZTMP))=""  ; FOR EACH DATE IN THE ARRAY
     63          . S ZCNT=ZCNT+1 ; INCREMENT THE COUNT
     64          . S ZTMP=$O(V2(ZTMP)) ; NEXT DATE
     65          . I $D(V2(ZTMP)) D  ; IF THE DATE EXISTS
     66          . . S ZP1=$P(V2(ZTMP),".",1) ; THE DATE PIECE
     67          . . S ZP2=$P(V2(ZTMP),".",2) ; THE TIME PIECE
     68          . . S VSRT(ZP1,ZP2_"00000"_ZCNT)=ZCNT ; HASH ON DATE AND TIME
     69          . . ; S VSRT($P(V2(ZTMP),U,4)_"000000"_ZCNT)=ZCNT ; PULL DATE
     70          . I DEBUG W "ZTMP=",ZTMP," "
     71          S V1(0)=ZCNT ; ARRAYS ARE THE SAME SIZE
     72          I DEBUG ZWR V2
     73          I DEBUG ZWR VSRT
     74          N ZD,ZT ; DATA AND TIME ITERATORS
     75          N ZDONE ; DONE FLAG
     76          S (ZD,ZT)=""
     77          S ZDONE=0
     78          N UORDR ; ORDER TO USE 1=FORWARD -1=REVERSE
     79          S UORDR=ORDR ; DIRECTION TO SORT
     80          I ORDR="" S UORDR=1
     81          N ZZCNT S ZZCNT=0 ; ANOTHER COUNTER
     82          F ZI=0:0 D  Q:ZDONE  ; VISIT THE ARRAY IN DATE ORDER
     83          . S ZD=$O(VSRT(ZD),UORDR) ; NEXT DATE
     84          . I ZD="" S ZDONE=1
     85          . I 'ZDONE D  ; MORE DATES
     86          . . S ZT="" ; WANT FIRST TIME FOR THIS DATE
     87          . . F ZJ=0:0 D  Q:$O(VSRT(ZD,ZT),UORDR)=""  ; LOOP THROUGH ALL TIMES
     88          . . . S ZT=$O(VSRT(ZD,ZT),UORDR) ; NEXT TIME
     89          . . . S ZZCNT=ZZCNT+1 ; INCREMENT COUNTER
     90          . . . S V1(ZZCNT)=VSRT(ZD,ZT) ; PULL OUT THE INDEX
     91          Q ZCNT
     92          ;
  • ccr/trunk/p/GPLCCD.m

    r111 r121  
    205205    . . ;  TO GET RID OF DUPLICATES
    206206    S I="" ; GOING TO $O THROUGH THE HASH
    207     F J=0:0 D  Q:$O(K(I))=""
     207    F J=0:0 D  Q:$O(K(I))=""  ;
    208208    . S I=$O(K(I)) ; WALK THROUGH THE HASH OF ACTORS
    209209    . S $P(L,U,1)=I ; FIRST PIECE IS THE OBJECT ID
  • ccr/trunk/p/GPLPROBS.m

    r104 r121  
    3434          K @TVMAP,@TARYTMP ; KILL OLD ARRAY VALUES
    3535          D LIST^ORQQPL3(.RPCRSLT,DFN,"") ; CALL THE PROBLEM LIST RPC
    36           I '$D(RPCRSLT(1)) D  Q ; RPC RETURNS NULL
     36          I '$D(RPCRSLT(1)) D  Q  ; RPC RETURNS NULL
    3737          . W "NULL RESULT FROM LIST^ORQQPL3 ",!
    3838          . S @OUTXML@(0)=0
  • ccr/trunk/p/GPLUNIT.m

    r86 r121  
    8181          I '$D(ZARY(WHICH))  D  ; TEST SECTION DOESN'T EXIST
    8282          . W "ERROR -- TEST SECTION DOESN'T EXIST -> ",WHICH,!
    83           . Q ; EXIT
     83          . Q  ; EXIT
    8484          N FIRST,LAST
    8585          S FIRST=$P(ZARY(WHICH),"^",1)
     
    113113          W !
    114114          W "THE TESTS!",!
    115           ZWR ZTMP
     115          I DEBUG ZWR ZTMP
    116116          Q
    117117          ;
  • ccr/trunk/p/GPLVITAL.m

    r120 r121  
    3737          S VITTARYTMP=$NA(^TMP("GPLCCR",$J,"VITALARYTMP"))
    3838          K @VITTVMAP,@VITTARYTMP ; KILL OLD ARRAY VALUES
    39           N VSORT,VCNT ; ARRAY FOR DATE SORTED VITALS INDEX
    40           S VCNT=$$VITSORT(.VSORT,.VITRSLT) ; PUT VITALS IN DATE ORDER
    41           ; AND COUNT THEM VSORT CONTAINS INDEXES ONLY
     39          N VSORT,VDATES,VCNT ; ARRAY FOR DATE SORTED VITALS INDEX
     40          D VITDATES(.VDATES) ; PULL OUT THE DATES INTO AN ARRAY
     41          I DEBUG ZWR VDATES ;DEBUG
     42          S VCNT=$$SORTDT^CCRUTIL(.VSORT,.VDATES,-1) ; PUT VITALS IN REVERSE
     43          ; DATE ORDER AND COUNT THEM. VSORT CONTAINS INDIRECT INDEXES ONLY
    4244          F J=1:1:VCNT  D  ; FOR EACH VITAL IN THE LIST
    4345          . I $D(VITRSLT(VSORT(J))) D
     
    182184          Q
    183185          ;
    184 VITSORT(V1,V2) ; DATE SORT VITALS ARRAY AND RETURN INDEX IN V1 AND COUNT
     186VITSORT(V1,V2) ; DEPRECATED USE $$RSORTDT^CCRUTIL
     187               ; DATE SORT VITALS ARRAY AND RETURN INDEX IN V1 AND COUNT
    185188               ; AS EXTRINSIC
    186189               ; BOTH V1 AND V2 ARE PASSED BY REFERENCE
     
    189192          S ZCNT=0 ; COUNTING NUMBER OF VITALS
    190193          S ZTMP="" ;
    191           F ZI=0:0 D  Q:$O(V2(ZTMP))="" ; FOR EACH VITAL IN THE ARRAY
     194          F ZI=0:0 D  Q:$O(V2(ZTMP))=""  ; FOR EACH VITAL IN THE ARRAY
    192195          . S ZCNT=ZCNT+1 ; INCREMENT THE COUNT
    193196          . S ZTMP=$O(V2(ZTMP)) ; NEXT VITAL
     
    206209          S ZDONE=0
    207210          N ZZCNT S ZZCNT=0 ; ANOTHER COUNTER
    208           F ZI=0:0 D  Q:ZDONE ; VISIT THE ARRAY IN DATE ORDER
     211          F ZI=0:0 D  Q:ZDONE  ; VISIT THE ARRAY IN DATE ORDER
    209212          . S ZD=$O(VSRT(ZD),-1) ; NEXT DATE
    210213          . I ZD="" S ZDONE=1
     
    219222          Q ZCNT
    220223          ;
     224VITDATES(VDT) ; VDT IS PASSED BY REFERENCE AND WILL CONTAIN THE ARRAY
     225         ; OF DATES IN THE VITALS RESULTS
     226         N VDTI,VDTJ,VTDCNT
     227         S VTDCNT=0 ; COUNT TO BUILD ARRAY
     228         S VDTJ="" ; USED TO VISIT THE RESULTS
     229         F VDTI=0:0 D  Q:$O(VITRSLT(VDTJ))=""  ; VISIT ALL RESULTS
     230         . S VDTJ=$O(VITRSLT(VDTJ)) ; NEXT RESULT
     231         . S VTDCNT=VTDCNT+1 ; INCREMENT COUNTER
     232         . S VDT(VTDCNT)=$P(VITRSLT(VDTJ),U,4) ; PULL OUT THE DATE
     233         Q
     234         ;
Note: See TracChangeset for help on using the changeset viewer.