Conversion from QUIZ to QTP, Part II

Michael Lee mcl_systems@bc.sympatico.ca
Thu, 08 Jul 1999 15:39:07 -0700


Hi Rich. I would have to agree with your guess that your timing is off. When I was
in the Toronto office of Cognos some people there took the time to explain QTP TIME
ZONEs to me (Jack McKittrick, Doug Lucy and Doug Blackmore). It has helped me a lot
with QTP (up until then one of my weaknesses) and hopefully it will help you.

On the ITEM statement for t_GROUP_COUNT you have ".... AT SORT_STUFF"-which means do
the ITEM statement AT the control break for SORT_STUFF. Yet on OUTPUT statement you
have a straight ADD. This means that the OUTPUT statement and it's associated ITEM
statements are handled at the DETAIL level.

QTP does not necessarily handle processing from the top on down, but rather handles
things at certain TIMES and within certain constructs from the top on down. So when
you first fire off the program it will do any INITIAL AT START processing
(equivelant to a QUIZ INITIAL HEADING). It would go through the code looking for any
processing that occurs within that TIME ZONE (this would include initializing
anything with AT FINAL-which would be equivelant to a QUIZ FINAL FOOTING).

It would then move to the INITIAL processing of the 1st control break (QUIZ HEADING
AT) and process any code in the same TIME ZONE as that control break (i.e. in the
following example anything with AT MY_CRITERIA. This would include initializing
anything to be processed at the end of the MY_CRITERIA (QUIZ FOOTING AT) control
break as well.

This would occur the same for the beginning of the other two control breaks
(FILE_TEST_DATE and SORT_STUFF) as well. Then it would go into the detail level
(QUIZ REPORT statement) time zone-the actual transactions themselves. This is
anything with no specific AT processing (including =, COUNT, SUBTOTAL, etc). Then it
would do end of detail processing. This would include doing the OUTPUT QT123_FILE
ADD and it's associated ITEM statements (this is what I meant previously by within
certain contructs. If you have the ITEM statement for the T_GROUP_COUNT after the
OUTPUT QT123_FILE ADD but before QT123_FILE's  ITEMs it wouldn't get processed at
this time.)

After that it would going into the end-of-sort-item-SORT_STUFF TIME ZONE and do
processing associated with that such as your ITEM T_GROUP_COUNT ... AT SORT_STUFF
statement. This means the file gets written before the ITEM statement for
T_GROUP_COUNT gets processed-hence your miscount.

Being that you are counting AT the control break but writing at the transaction
level it's hard to hazard a guess at what you should do. You do have to get your
transactions within the same TIME ZONE though to get things working properly. You
can do that by putting an AT on your OUTPUT QT123_FILE statement or removing the one
on your ITEM T_GROUP_COUNT statement. If neither of these make sense you have a
problem...


Good luck, I hope this helps you.


Michael Lee
MCL Systems Inc.


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.
>
> Any info is appreciated!  TIA!
>
> Rich Jesse                              Programmer/Analyst (/DBA/SysAdmin/etc.)
> rjesse@qtiworld.com                     Quad/Tech International, Sussex, WI USA
> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
> Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
> powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
> This list is closed, thus to post to the list, you must be a subscriber.

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
This list is closed, thus to post to the list, you must be a subscriber.