Consultor Eletrônico



Kbase 20376: Error 560 trying to get current value of a Combo-box field defined as an INTEGER data type
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   05/12/2008
Status: Verified

SYMPTOM(s):

Error 560 trying to get current value of a Combo-box field defined as an INTEGER data type

Entry <entry#> is outside the range of list <list-string>. (560)

Using a code like:

ON CHOOSE OF BUTTON-1 IN FRAME fMain /* Combo value*/
DO:
MESSAGE ENTRY(LOOKUP(COMBO1:SCREEN-VALUE,COMBO1:LIST-ITEM-PAIRS) - 1,COMBO1:LIST-ITEM-PAIRS).
END.

FACT(s) (Environment):

Combo-box have a LIST-ITEM-PAIRS set
Windows
Progress 7.x
Progress 8.x
Progress 9.x
OpenEdge 10.x

FIX:

Get the length difference between the screen-value format and the DataDictionary format of the field, then add spaces to it and run the same function.

For example:

- Screen-value of custnum = "10"
- Combo-box LIST-ITEM PAIR value of custnum = " 10"

Since in DataDictionary the format for custnum is ">>>>9", and the blank positions are still there.

The following code example illustrates a Combo-Box related to customer.custnum:


ON CHOOSE OF BUTTON-4 IN FRAME fMain /* Combo value*/
DO:
DEF VAR s-value AS CHAR.
DEF VAR difference AS INTEGER.
DEF VAR i AS INTEGER.

s-value = customer.custnum:SCREEN-VALUE.

difference= length(Customer.CustNum:FORMAT) - LENGTH(s-value).
IF difference >= 1 THEN
DO i = 1 TO difference:
s-VALUE = " " + s-VALUE.
END.

MESSAGE ENTRY(LOOKUP(S-VALUE,customer.custnum:LIST-ITEM-PAIRS) - 1, customer.custnum:LIST-ITEM-PAIRS).
END.

Note that the screen-value of the Combo-Box has the same syntax as the Combo-Box that is not related to a db-field.

MESSAGE Customer.CustNum:SCREEN-VALUE.