Conversion from QUIZ to QTP, Part II

Maloney, Charlie Charlie.Maloney@Cognos.com
Thu, 8 Jul 1999 18:48:57 -0400


In QUIZ there are five major timing instructions performed in this order:

  INITIAL HEADING
  HEADING AT sortitem
  REPORT
  FOOTING AT sortitem
  FINAL FOOTING

With item processing in QTP, there are also five major timing instructions,
performed in this order:

  AT INITIAL
  AT START OF sortitem
  no timing instruction <detail operation>
  AT sortitem
  AT FINAL

In QTP it's actually more complicated than this, because there's both
an initialization step with five timing options and a processing step 
with five timing options, along with some differences in TEMP processing, 
but those differences don't apply here.

The "AT sortgroup" instructions are not performed until AFTER the 
detail operation.  In your case, your TEMP counter isn't getting
incremented until after the detail record is written out.

Try changing the counter to "AT START OF" sortitem.  If all of your
DEFINES reference information which remains constant in set of 
records for the sortitem, the counter value will increment 
properly.

We teach this and lots of other interesting QTP tidbits in the
Advanced PowerHouse Courses.

Charlie Maloney
Technical Account Manager
Charlie.Maloney@cognos.com
PH:  781 313 2305
FX:  781 229 6426


-----Original Message-----
From: Rich `Lego-Man' Jesse - 7633 [mailto:RJESSE@QTIWORLD.COM]
Sent: Thursday, July 08, 1999 5:19 PM
To: powerh-l@lists.swau.edu
Subject: Conversion from QUIZ to QTP, Part II


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.