Conversion from QUIZ to QTP, Part II
Mike Palandri
palandri@4j.lane.edu
Fri, 09 Jul 1999 06:51:38 -0700
At 04:18 PM 07/08/1999 -0500, Rich `Lego-Man' Jesse - 7633 wrote:
>Hey again,
>
>I've got everything in my QUIZ report converted to QTP (733d3 on HP
10.20
>accessing an Oracle 7.3.4.3.0 db), except for a counter that's giving me
some
>trouble. I've looked in the manuals, looked at examples, and tried a
bunch of
>variations on the counter with no luck.
>
>Here's the closest I've come to obtaining the correct results (just a
working
>fragment of the actual code):
>
> RUN QT123
> REQUEST QT123
> SET PROCESS NOLIMIT
> SET LOCK FILE UPDATE
>
> ACCESS DB_FILE01 &
> LINK MY_KEY OF DB_FILE01 VIAINDEX F02_MY_KEY TO DB_FILE02
>
> DEFINE COMPARE_TODAYS_DATE NUM = DAYS(SYSDATE)
> DEFINE D_TODAYS_DATE DATE = SYSDATE
> DEFINE D_FILE_TEST_DATE NUM = DAYS(FILE_TEST_DATE OF DB_FILE02)
> DEFINE D_MASTER_LABEL_COUNT NUM*5 = 1
>
> DEFINE D_TOT_QTY FLOAT SIZE 8 = (QTY01 OF DB_FILE01 + QTY02 OF
DB_FILE01)
> DEFINE SORT_STUFF CHAR*34 = ORDERNO OF DB_FILE01 + &
> OTHERNO OF DB_FILE01 + PARTNO OF DB_FILE01
> DEFINE MY_CRITERIA NUM*1 = 1 IF (D_FILE_TEST_DATE >=
COMPARE_TODAYS_DATE) OR &
> (RSTATUS OF DB_FILE02 = "R" AND CFLAG OF DB_FILE02 = "Y" AND &
> LFLAG OF DB_FILE02 = " ") ELSE 0
>
> SELECT IF 0 <> D_TOT_QTY
>
> SORT &
> ON MY_CRITERIA &
> ON FILE_TEST_DATE OF DB_FILE02 &
> ON SORT_STUFF
>
> DEFINE D_GROUP_COUNT NUM*5 = 1 IF (1 = MY_CRITERIA) ELSE 0
> TEMPORARY T_GROUP_COUNT NUM*5
> ITEM T_GROUP_COUNT SUBTOTAL D_GROUP_COUNT AT SORT_STUFF
>
> OUTPUT QT123_FILE ADD
> ITEM ORDERNO FINAL ORDERNO OF DB_FILE01
> ITEM FILE_TEST_DATE FINAL FILE_TEST_DATE OF DB_FILE02
> ITEM TOT_QTY FINAL D_TOT_QTY
> ITEM TODAYS_DATE FINAL D_TODAYS_DATE
> ITEM GROUP_COUNT FINAL T_GROUP_COUNT
>
> GO
> EXIT
>
>My problem is the item GROUP_COUNT. The count is short by one. It's
missing
>the first group. Maybe it's a problem with the way I'm doing the
subtotaling?
>Or maybe a problem of timing between the AT SORT_STUFF and when the
DEFINEs and
>TEMPORARYs get evaluated?
>
>I've checked thru the QTP Reference manual, the "Using QTP" manual, and
the
>Cognos website. I figured I'd stop here first before logging a call.
Rich,
I've used a manual increment technique in situations like this with good
results. Here's an example based on our personnel file. The condition
on the item statement is silly, but I stuck it in to make sure it would
work as I remembered.
access pos-emp
sort on emp-no
temp ti-cnt int*06
item ti-cnt = ti-cnt + 1 if emp-no < "999999" reset at emp-no
subfile test at emp-no keep include emp-no, ti-cnt
set process nolimit
Mike