quiz, last nonblank

Pilgrim, Mary Mary.Pilgrim@Cognos.COM
Fri, 16 Jun 2000 13:05:14 -0400


File called FILE1 contains:

FILE1

  Key   Item1

  0001  xxx        
  0002              
  0003              
  0004              
  0005  yyy         
  0006  www         
  0007              
  0007              
  0007             
  0007  ttt         
  0008              
  0009  iii         
  0010       
       
; The first pass gives each record a running count

ACCESS file1
DEFINE dcnt = 1
REPORT SUMMARY key item1 dcnt SUBTOTAL NORESET
SORT ON key
SET SUB NAME subkk1 KEEP
GO

; The second pass creates a subfile containing 
; each record with a constant repeating key

ACCESS *subkk1
DEFINE dcb CHAR*1 = "X"
REPORT SUMMARY  dcnt key item1 dcb
SET SUBFILE NAME subk1 KEEP INDEX dcb REPEATING
GO

; The last pass links the subfile to itself, selecting
; only the records that come before it in the list
; which have either the same value in both records, or a
; blank value.  Then define an item that takes the non-blank
; value from the subfile or from the alias.

ACCESS *subk1 LINK ("X") TO *subk1 ALIAS k1
SELECT k1 IF dcnt OF k1 <= dcnt OF subk1 AND item1 OF k1 <> " "
SELECT IF item1 OF subk1 = item1 OF k1 &
       OR item1 OF subk1 = " "
DEFINE ditem1 CHAR*10 = item1 OF subk1 IF item1 OF subk1 <> " " &
                   ELSE item1 OF k1
SORTED ON dcnt
FOOTING AT dcnt key item1 ditem1
GO
This may not be a practical/efficient way of doing it but it works in QUIZ:

  Key   Item1       DITEM1

  0001  xxx         xxx
  0002              xxx
  0003              xxx
  0004              xxx
  0005  yyy         yyy
  0006  www         www
  0007              www
  0007              www
  0007              www
  0007  ttt         ttt
  0008              ttt
  0009  iii         iii
  0010              iii

-----Original Message-----
From: Bob Comeau [mailto:bcomeau@crossley.ca]
Sent: Thursday, June 15, 2000 2:20 PM
To: powerh-l@lists.swau.edu
Subject: quiz, last nonblank


I am reporting a set of records which contains a field that may be blank
because the related record was optional.  How can I define a field such that
it contains the current value of the problem field if is there (not blank or
empty) otherwise it will contain the last real value for that field
encountered so far in the report.


Bob Comeau


= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
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
This list is closed, thus to post to the list, you must be a subscriber.