Question Question of combo box in a browse

wa4qms

New Member
For years most of my work was with the back end in progress, with some GUI. So I am building a completely new GUI interface and have a question regarding the use of a combo box. I understand how to populate it, done it many times on screens, but never within a browse. So lets say there 4 values, EACH, CASE, BOX, and DOZ. These values will be part of the data that will imported, and what I'd like to do is that if the person pull the drop down and selects 1 of the 4, create a filter that only those records as displayed. I do not want to update the cell. Something very similar to the way Excel filters work. Thoughts?
-Dennis-
(Really getting too old for this.)
 

Osborne

Active Member
Is something like this similar to what you are looking for?:
Code:
DEFINE VARIABLE cOption AS CHARACTER NO-UNDO.

DEFINE TEMP-TABLE ttCustomers NO-UNDO
   FIELD iCustNum AS INTEGER LABEL "Cust #" FORMAT ">>9"
   FIELD cCustName AS CHARACTER LABEL "Cust Name" FORMAT "X(20)"
   FIELD cOptions AS CHAR LABEL "Option"
   INDEX idxCustNum IS PRIMARY UNIQUE iCustNum
   INDEX idxOptions IS UNIQUE cOptions iCustNum.

DEFINE QUERY q1 FOR ttCustomers SCROLLING.

DEFINE BROWSE b1 QUERY q1
   DISPLAY ttCustomers.iCustNum
           ttCustomers.cCustName
           ttCustomers.cOptions WIDTH 14 VIEW-AS COMBO-BOX INNER-LINES 4 DROP-DOWN-LIST
   ENABLE ttCustomers.cOptions
   WITH 4 DOWN NO-ASSIGN SEPARATORS.

DEFINE FRAME f1 b1
   WITH SIDE-LABELS AT ROW 2 COLUMN 2.

ON VALUE-CHANGED OF ttCustomers.cOptions IN BROWSE b1 DO:
   cOption = SELF:SCREEN-VALUE.
   OPEN QUERY q1 FOR EACH ttCustomers WHERE ttCustomers.cOptions = cOption.
   APPLY "ENTRY" TO ttCustomers.cOptions IN BROWSE b1.
END.

ttCustomers.cOptions:LIST-ITEMS IN BROWSE b1 = "EACH,CASE,BOX,DOZ".

CREATE ttCustomers.
ASSIGN ttCustomers.iCustNum  = 1
       ttCustomers.cCustName = "Customer Number 1"
       ttCustomers.cOptions  = "CASE".
CREATE ttCustomers.
ASSIGN ttCustomers.iCustNum  = 2
       ttCustomers.cCustName = "Customer Number 2"
       ttCustomers.cOptions  = "DOZ".
CREATE ttCustomers.
ASSIGN ttCustomers.iCustNum  = 3
       ttCustomers.cCustName = "Customer Number 3"
       ttCustomers.cOptions  = "EACH".
CREATE ttCustomers.
ASSIGN ttCustomers.iCustNum  = 4
       ttCustomers.cCustName = "Customer Number 4"
       ttCustomers.cOptions  = "BOX".

OPEN QUERY q1 FOR EACH ttCustomers.
ENABLE b1 WITH FRAME f1.

WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.
 

wa4qms

New Member
This could very well be what I need to build the function. There up to 38,000 items in the browse, but only really about 15 to 20 different types of case-packing. I'll have to try that later this week as I've got a few other items that need correcting first. Thanks for the info.
 
Top