--------------F65D593330598C8C98B7D80F Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I'm not exactly sure what you are trying to do as the specs are rather limited (no more so than usual though). I think that you are implying that you don't care what the status was or what it's changing to you simply care that it has changed. In QTP this requires the technique for looking at the previous record which can be done with temporaries as follows: acc STUDENT-TABLE <-- or whatever the filename is... sort on STUDENT_ID <--- or whatever the fieldname is... temp t_LAST_STATUS char*01 (same as your current status field on the file) subfile changsb keep inc STUDENT-TABLE if t_LAST_STATUS <> STATUS and & t_LAST_STATUS <> ' ' item t_LAST_STATUS = STATUS of STUDENT-FILE reset at STUDENT_ID When the subfile goes to evaluate the IF statement the 1st time t_LAST_STATUS is blank since the ITEM statement for the temporary has not been processed and therefore no record is written to the subfile. It then processes the ITEM statement for t_LAST_STATUS and moves in the STATUS. When it reads the next record for that same STUDENT_ID it has both the previous (in t_LAST_STATUS) and the current STATUS for that student. When it processes the SUBFILE statement it won't write a record until they are different (i.e. REC. NO. 4). You must reset the temporary t_LAST_STATUS to ' ' when the STUDENT_ID changes as well. This is not a perfect example as I haven't been able to test it but the fundamentals are there. As well I find writing these programs in QDESIGN to be very effective. The main advantages of QDESIGN being the lack of a PROCESS LIMIT and the ability to break when you want. For example if you only care if there was a change with the student but weren't concerned with whether it was one change or a hundred changes. In this case when the criteria was hit you could simply do a break for that student and go on to the next student. Regards, Michael Lee MCL Systems Inc. Robert Elsner wrote: > Would any of you know how to implement an onChange function? > > If I have the following records with three fields, an ID# and status code, > and MonthYear: > > REC NO. 1 111111 F 198 > REC NO. 2 111111 F 298 > REC NO. 3 111111 F 398 > REC NO. 4 111111 H 498 > REC NO. 5 111111 F 598 > > I would like it to tell me that Student 111111 has changed in REC #4. > > I have a feeling this would require some playing around with QTP. > > Thanks in advance, > > Robert > > = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = > 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. --------------F65D593330598C8C98B7D80F Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit I'm not exactly sure what you are trying to do as the specs are rather limited (no more so than usual though). I think that you are implying that you don't care what the status was or what it's changing to you simply care that it has changed. In QTP this requires the technique for looking at the previous record which can be done with temporaries as follows:acc STUDENT-TABLE <-- or whatever the filename is...
sort on STUDENT_ID <--- or whatever the fieldname is...
temp t_LAST_STATUS char*01 (same as your current status field on the file)
subfile changsb keep inc STUDENT-TABLE if t_LAST_STATUS <> STATUS and &
t_LAST_STATUS <> ' 'item t_LAST_STATUS = STATUS of STUDENT-FILE reset at STUDENT_ID
When the subfile goes to evaluate the IF statement the 1st time t_LAST_STATUS is blank since the ITEM statement for the temporary has not been processed and therefore no record is written to the subfile. It then processes the ITEM statement for t_LAST_STATUS and moves in the STATUS. When it reads the next record for that same STUDENT_ID it has both the previous (in t_LAST_STATUS) and the current STATUS for that student. When it processes the SUBFILE statement it won't write a record until they are different (i.e. REC. NO. 4). You must reset the temporary t_LAST_STATUS to ' ' when the STUDENT_ID changes as well.
This is not a perfect example as I haven't been able to test it but the fundamentals are there. As well I find writing these programs in QDESIGN to be very effective. The main advantages of QDESIGN being the lack of a PROCESS LIMIT and the ability to break when you want. For example if you only care if there was a change with the student but weren't concerned with whether it was one change or a hundred changes. In this case when the criteria was hit you could simply do a break for that student and go on to the next student.
Regards,
Michael Lee
MCL Systems Inc.
Robert Elsner wrote:
Would any of you know how to implement an onChange function?If I have the following records with three fields, an ID# and status code,
and MonthYear:REC NO. 1 111111 F 198
REC NO. 2 111111 F 298
REC NO. 3 111111 F 398
REC NO. 4 111111 H 498
REC NO. 5 111111 F 598I would like it to tell me that Student 111111 has changed in REC #4.
I have a feeling this would require some playing around with QTP.
Thanks in advance,
Robert
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
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.