Consultor Eletrônico



Kbase P16724: 4GL/ABL: How to populate a COMBO-BOX from a database table?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   29/12/2008
Status: Verified

GOAL:

4GL/ABL: How to populate a COMBO-BOX from a database table?

GOAL:

How to eliminate duplicates when populating COMBO-BOX from a database table?

GOAL:

How to initialize a COMBO-BOX with a blank SCREEN-VALUE?

GOAL:

How to initialize a COMBO-BOX with a non blank SCREEN-VALUE?

FACT(s) (Environment):

All Supported Operating Systems
Progress 8.x
Progress 9.x
OpenEdge 10.x

FIX:

2. The following code populates a COMBO-BOX with all the Customer.Country field values including duplicates and initializes its SCREEN-VALUE to a blank:

FOR EACH Customer NO-LOCK BREAK BY Customer.Country:
MyComboBox:ADD-LAST(Customer.Country) IN FRAME {&FRAME-NAME}.
END.
MyComboBox:SCREEN-VALUE = MyComboBox:ENTRY(1).
2. The following code populates a COMBO-BOX with all the Customer.Country field values excluding duplicates and initializes its SCREEN-VALUE to a Customer.Country:

FOR EACH Customer NO-LOCK BREAK BY Customer.Country:
IF LAST-OF(Customer.Country) THEN
MyComboBox:ADD-LAST(Customer.Country) IN FRAME {&FRAME-NAME}.
END.
MyComboBox:SCREEN-VALUE = MyComboBox:ENTRY(1).