[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

[sqr-users] on break help



Hi all

            I am having problem with on break. 

            I was trying to print out some entries and group by operID
and Date. Here is the result I have(partial)

 

06/02/04      SCOTE          130160000000   Nr Grad          1
$      7,435.20

 

06/02/04      SCOTE          191200000000   Activ Fee        1
$      7,497.80

 

                        total for operator:                  2
7,497.80

 

                        total for date:                      2
7,497.80

 

            for everything else it is correct except the total for
operator and total for the date. If within the same date and sme operID
there are more than one entries, the first one will be ignored. (Except
the very first record, the first entry will be counted)

            The following is the code and I aslo prined each time when
'subtotal' is called. I found it is not called by when the item changes.
Is that a bug or anything I did was wrong? Thanks!

 

begin-procedure SelectData

LET #SUBTOTAL=0

LET #COUNTER=0

LET $OLDpID=''

let $oldnm=''

let $olddes=''

let $olddt=''

let #first=1 

BEGIN-SELECT    

 

BURSAR_ITM_TYP_NM                           () on-break print=never
level=3 after=subtotal

BURSAR_ITM_TYP_SHRT_DESC                

TO_CHAR(SF_ITM_POST_DT, 'MM/DD/YY')           &SF_ITM_POST_DT   ()
on-break print=never level=1 after=Datetotal

sum(BURSAR_ITM_LN_AMT)                        &BURSAR_ITM_LN_AMT

PSE_OPR_ID                                  () on-break print=never
level=2 after=IDtotal

 

    

    LET #BURSAR_ITM_LN_AMT=&BURSAR_ITM_LN_AMT

 

    if ($oldnm<>&BURSAR_ITM_TYP_NM or $oldpid<>&PSE_OPR_ID or
$olddt<>&SF_ITM_POST_DT )

        let $oldnm  =&BURSAR_ITM_TYP_NM

        let $oldpid =&PSE_OPR_ID

        let $olddes =&BURSAR_ITM_TYP_SHRT_DESC

        let $olddt  =&SF_ITM_POST_DT 

        let #subtotal=&BURSAR_ITM_LN_AMT+#subtotal

        if #first=1

            let #counter=#counter+1  !paly tricks with the counters of
the very first record

        end-if

        Do ReportLine

        if #first=1

            let #counter=#counter - 1

        end-if        !paly tricks with the counters of the very first
record

           

        let #first=0

    else 

        if ($oldnm=&BURSAR_ITM_TYP_NM and $oldpid=&PSE_OPR_ID and
$olddt<>&SF_ITM_POST_DT)

            let #counter=#counter+1

            let #subtotal=&BURSAR_ITM_LN_AMT+#subtotal

                       

         end-if

    end-if             

        

     

FROM  DSS_RDS.SF_ALL_ITM_GT 

[$where] and rownum<1790

group by BURSAR_BSNS_UNIT_CD,BURSAR_ITM_TYP_NM,BURSAR_ITM_TYP_SHRT_DESC,

         SF_ITM_POST_DT,PSE_OPR_ID

order BY  SF_ITM_POST_DT, PSE_OPR_ID, BURSAR_ITM_TYP_NM

  

!

!

!

!

!    Do Data

!

!

!

!WHERE 1=0

![$and]

!

END-SELECT

 

 

 

end-procedure

 

-----------------------------------------------------

BEGIN-PROCEDURE SUBTOTAL

!-----------------------------------------------------

let #idcounter=#counter+#idcounter

let #idsubtotal=#subtotal+#idsubtotal

show 'subtotal' #subtotal        

show 'idsubtotal' #idsubtotal

LET #SUBTOTAL=0

LET #COUNTER=1     

END-PROCEDURE SUBTOTAL

 

!-----------------------------------------------------

BEGIN-PROCEDURE IDTOTAL

!-----------------------------------------------------

show 'idsubtotal' #idsubtotal

print 'total for operator: '  (+1, 25)

print #idcounter          (,60)  edit 999

print #idsubtotal            (,75)  edit 9,999,999,999.00

let #datecounter=#datecounter+#idcounter

let #datetotal=#datetotal+#idsubtotal

let #idcounter=0  

let #idsubtotal=0   

END-PROCEDURE IDTOTAL

 

!-----------------------------------------------------

BEGIN-PROCEDURE DATETOTAL

!-----------------------------------------------------

show 'datesubtotal' #datesubtotal!let
#dateconunter=#datecounter+#idcounter

 print 'total for date: '  (+1, 25)

 print #datecounter          (,60)  edit 999

 print #datetotal            (,75)  edit 9,999,999,999.00

let #datecounter=0     

let #datetotal=0

END-PROCEDURE DATETOTAL

Zhen Pan

University Information Technology Services

HRMS/SIS Team 

work (812)856-4566

 

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users