Unexplained QTP behavior
David Morrison - Corporate
dmorrison@mcbrideelectric.com
Wed, 24 Sep 2003 11:54:10 -0700
Mike,
I don't think that you should sort on a field that you're calculating on the fly.
David Morrison
McBride Electric
-----Original Message-----
From: Mike Palandri [mailto:palandri@4j.lane.edu]
Sent: Wednesday, September 24, 2003 11:25 AM
To: powerh-l@lists.swau.edu
Subject: Unexplained QTP behavior
Sorry for the double post, I forgot the Subject on the original.
===================================
Hi yall,
I'm puzzled by some behavior I encountered in QTP 7.10 F4 OpenVMS. Here's
a simple example distilled from the longer program:
A file has four items and four records with the following values:
Item0 Item1 Item2 Item3
AAAAAA 111111 1 A
AAAAAA 111111 2 B
AAAAAA 111111 2 C
AAAAAA 111111 3 D
This QTP reads the file and creates a subfile:
CAN CLE
ACCESS TESTREC
TEMP TI-ITEM INT*02
TEMP TI-REC-CNT INT*10
ITEM TI-ITEM INITIAL 0
ITEM TI-REC-CNT INITIAL 0
SORT ON ITEM0, ITEM1, ITEM2, TI-REC-CNT
ITEM TI-REC-CNT = TI-REC-CNT + 1
ITEM TI-ITEM = ITEM2 AT TI-REC-CNT RESET AT ITEM1
SUBFILE TT1 KEEP INCLUDE &
ITEM0, &
ITEM1, &
ITEM2, &
TI-REC-CNT, &
TI-ITEM
Here's what ends up in the subfile:
Item0 Item1 Item2 TI-REC-CNT TI-ITEM
AAAAAA 111111 1 1 0
AAAAAA 111111 2 2 1
AAAAAA 111111 2 3 1
AAAAAA 111111 3 4 2
TI-REC-CNT provides a control break on every record. The break is used to
assign the value of ITEM2 to the temp TI-ITEM. Because TI-REC-CNT changes
on every record, I thought that this assignment would take place on every
record.
However, on the third record, where the value of Item2 is the same as Item2
in the second record, the break never occurs, and the assignment of Item2
to TI-ITEM doesn't happen. The break truly does not occur; I ran a trace
and found "at end" processing of Ti-Rec-Cnt on the first, third, and
fourth complexes, but not the second:
# NEW RECORD COMPLEX -> 1
**** PROCESSING AT END OF TI-REC-CNT 1
**** ITEM TI-ITEM = : AT TI-REC-CNT
**** BEFORE 0
**** AFTER 1
# NEW RECORD COMPLEX -> 3
**** PROCESSING AT END OF TI-REC-CNT 3
**** ITEM TI-ITEM = : AT TI-REC-CNT
**** BEFORE 1
**** AFTER 2
# NEW RECORD COMPLEX -> 4
**** PROCESSING AT END OF TI-REC-CNT 4
**** ITEM TI-ITEM = : AT TI-REC-CNT
**** BEFORE 2
**** AFTER 3
However, if an additional sort key is inserted on the sort statement
between Item2 and Ti-Rec-Cnt, the "At end" processing for Ti-Rec-Cnt occurs
on all four complexes, and the code works as (I) expected.
New sort statement:
SORT ON ITEM0, ITEM1, ITEM2, ITEM3, TI-REC-CNT
New resulting subfile:
Item0 Item1 Item2 TI-REC-CNT TI-ITEM
AAAAAA 111111 1 1 0
AAAAAA 111111 2 2 1
AAAAAA 111111 2 3 2
AAAAAA 111111 3 4 2
It seems to me that the "AT" for the lowest level sort key should be
processed the same regardless of the value of higher level sort keys, or
reports with headings at multiple levels of control breaks would not work.
Anybody know what's going on?
Thanks,
Mike
.
= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l@lists.swau.edu
Subscribe: "subscribe" in message body to powerh-l-request@lists.swau.edu
Unsubscribe: "unsubscribe <password>" in message body to
powerh-l-request@lists.swau.edu
http://lists.swau.edu/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber.
Mike
.
= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l@lists.swau.edu
Subscribe: "subscribe" in message body to powerh-l-request@lists.swau.edu
Unsubscribe: "unsubscribe <password>" in message body to powerh-l-request@lists.swau.edu
http://lists.swau.edu/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber.
_________________________________________________
Scanned on 24 Sep 2003 18:35:08
Scanning by http://erado.com