Distinct Record - Browse Maintenance

markluizdemauro27

New Member
Hi to all,

I just want to ask how to display distinct record or 1 record in a browse from browse maintenance. For example, in tr_hist table, 1 lot serial has many entries in tr_hist and i want to get and display only 1. Thanks.
 

markluizdemauro27

New Member
Hi to all,

I just want to ask how to display distinct record or 1 record in a browse from browse maintenance. For example, in tr_hist table, 1 lot serial has many entries in tr_hist and i want to get and display only 1. Thanks.
 

Osborne

Active Member
Is the problem that the records all have the same serial numbers and there is not a unique index available that can display just the one?

If that is the case, then I suppose one way is to use a temp table as a control record. Something like this:
Code:
DEFINE TEMP-TABLE ttSingleRec NO-UNDO
       FIELD field1 AS CHAR.

CREATE ttSingleRec.

DEFINE QUERY q1 FOR ttSingleRec, tr_hist SCROLLING.

OPEN QUERY q1 FOR EACH ttSingleRec,
     FIRST tr_hist WHERE tr_hist.serial = 1 NO-LOCK.
...
 

markluizdemauro27

New Member
Yes, there are many records with the same serial but there is no right field that i can use for filtering in order to display 1 record of it. How can I implement that codes in browse maintenance?
 

Osborne

Active Member
You implement as you would do for a standard browse:
Code:
DEFINE BROWSE b1
   QUERY q1 NO-LOCK DISPLAY
      tr_hist.serial tr_hist.otherFields
   ENABLE tr_hist.otherFields
   WITH SEPARATORS SIZE 50 BY 9.
Then have an option where the user can select the serial number and when they do open the query which updates the browse:
Code:
OPEN QUERY q1 FOR EACH ttSingleRec,
     FIRST tr_hist WHERE tr_hist.serial = vSerial NO-LOCK.
 
Top