Kbase P96610: How to avoid repeating the same field value in a browse
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  03/11/2004 |
|
Status: Unverified
GOAL:
How to avoid repeating the same field value in a browse
GOAL:
How to display a field value in a browse only when different from the one of the previous row
GOAL:
How to avoid showing in a browse the column value when it has the same value of the previous row
FIX:
Let's say that you want to display, instead of the default look of the browse:
cust-num order-num XXXX YYYY
--------------------------------------------
1 2 X Y
1 3 X Y
1 4 X Y
1 5 X Y
1 6 X Y
2 7 X Y
2 8 X Y
2 9 X Y
3 10 X Y
3 11 X Y
something like that:
cust-num order-num XXXX YYYY
--------------------------------------------
1 2 X Y
3 X Y
4 X Y
. 5 X Y
6 X Y
2 7 X Y
8 X Y
9 X Y
3 10 X Y
11 X Y
In order to do this you may use a calculated field instead of the cust-num column. You can use a code like:
DEFINE VARIABLE myCust-num AS CHAR NO-UNDO.
DEFINE VARIABLE oldCust-num AS INTEGER NO-UNDO.
DEFINE QUERY q1 FOR order SCROLLING.
DEFINE BROWSE b1 QUERY q1
DISPLAY (myCust-num) @ myCust-num order-num Order-Date
ENABLE Order-Date WITH 10 DOWN SEPARATORS MULTIPLE
TITLE "Update Credit Limits".
DEFINE FRAME f1 b1
WITH SIDE-LABELS ROW 2 CENTERED NO-BOX.
ON ROW-DISPLAY OF b1 IN FRAME f1
DO:
myCust-num = IF (order.cust-num = oldCust-num) THEN '' ELSE STRING (Cust-num).
oldCust-num = order.cust-num.
END.
OPEN QUERY q1 FOR EACH order NO-LOCK BY cust-num .
ENABLE ALL WITH FRAME f1.
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW. .