Kbase P25321: How to refer to the values and how to labels in a selection-list or a combo-box with LIST-ITEM-PAIRS
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  11/11/2008 |
|
Status: Verified
GOAL:
How to refer to the values in a selection-list or a combo-box with LIST-ITEM-PAIRS.
GOAL:
How to refer to the labels in a selection-list or a combo-box with LIST-ITEM-PAIRS.
FACT(s) (Environment):
Progress 9.x
OpenEdge 10.x
All Supported Operating Systems
FIX:
Let's assume that a selection-list or a combo-box contains two labels "One" and "Two", corresponding to values 1 and 2 respectively.
Accessing a specific value can be done with the ENTRY() method. In the given example, you can retrieve the Nth value with:
ASSIGN myValue = hSelectionList:ENTRY(n).
Referring to the labels is possible but not as straightforward, as there is no method that directly returns the label associated with a specific value.
The LIST-ITEM-PAIRS attribute returns a list of alternating labels and values, all separated by the character specified by the DELIMITER attribute (by default it's the comma); so, for the given scenario, the LIST-ITEM-PAIRS attribute will return the following:
One,1,Two,2
To retrieve the label associated with the Nth value the following is needed:
ASSIGN myLabel = ENTRY((n * 2) - 1,
hSelectionList:LIST-ITEM-PAIRS,
hSelectionList:DELIMITER).