Consultor Eletrônico



Kbase 33542: Combo-box is not keeping the default unknown-value within integer or decimal fields
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
Solution ID: P3542

FACT(s) (Environment):

Progress 8.x
Progress 9.x

SYMPTOM(s):

Combo-box is not keeping the default unknown-value within integer or decimal fields

CAUSE:

Expected behaviour.

If your Combo-Box field is defined in Data Dictionary as Initial Value "?" (unknown-value) and the field is integer.
If you assign his screen-value "?" this will save the record with a value of 0 (zero) within the record.

&Scoped-define ENABLED-FIELDS   Customer.Customerid Customer.HotelID Customer.CountryID
&Scoped-define DISPLAYED-FIELDS Customer.Customerid Customer.HotelID Customer.CountryID

DEFINE FRAME a
 customer.Customerid VIEW-AS FILL-IN
 customer.HotelID VIEW-AS COMBO-BOX LIST-ITEM-PAIRS "Hotel 0",0,"Hotel 1",1,"Hotel 2",2
 customer.CountryID VIEW-AS FILL-IN
 .

ON 'go':U OF FRAME a
DO:
  MESSAGE "Screen-Values" SKIP
          Customer.CustomerID:SCREEN-VALUE IN FRAME a
          Customer.HotelID:SCREEN-VALUE IN FRAME a
          Customer.CountryID:SCREEN-VALUE IN FRAME a
          VIEW-AS ALERT-BOX.         

  ASSIGN FRAME a {&enabled-fields}.
  FIND CURRENT Customer NO-LOCK.

  MESSAGE "Values stored to DB" SKIP
          Customer.CustomerID
          Customer.HotelID
          Customer.CountryID VIEW-AS ALERT-BOX.     
       
  DISPLAY {&displayed-fields} WITH FRAME a.

  RETURN.
END.

CREATE Customer.

DISPLAY {&displayed-fields} WITH FRAME a.
ENABLE  {&ENABLED-fields} WITH FRAME a.

VIEW FRAME a.

WAIT-FOR "go" OF FRAME a.

HIDE FRAME a.

FIX:

You will not be able to do a assign as the example is showing.
You need to check the Screen-Value of the combo-box and do an assign of the unknown-value.

In previous example the assign is done as follow:

ASSIGN FRAME a {&enabled-fields}.

do the following:

ASSIGN Customer.Customerid  Customer.CountryID.
IF HOTELID:SCREEN-VALUE IN FRAME a = "?" THEN
ASSIGN HOTELID = "?".

This will save the integer field as Unknown-value instead of 0 (zero).