'How to hide form fields data? - PROGRESS 4GL?

Below query is giving results as expected but it fails to hide form field value when the variable lvl_select is set to Yes or No after updating the form fields.

Expected Results:

When lvl_select = Yes then update only form field lvc_part

When lvl_select = no then hide update the value of the form field lvc_part and update lvc_part1 whereas lvc_part1 then hide the value of the form field lvc_part and update lvc_part1

DEFINE VARIABLE lvl_select AS LOGICAL NO-UNDO.
DEFINE VARIABLE lvc_part AS CHARACTER NO-UNDO.
DEFINE VARIABLE lvc_part1 AS CHARACTER NO-UNDO.
DEFINE VARIABLE  path AS CHARACTER NO-UNDO.

FORM
lvl_select COLON 20
lvc_part COLON 20
lvc_part1 COLON 20
path

WITH FRAME a  no-labels width 80 ATTR-SPACE.

mainloop:
REPEAT:
   DISPLAY 
     lvl_select
     lvc_part
     lvc_part1
     path
     WITH FRAME a.

   UPDATE 
     lvl_select
     WITH FRAME a.

   IF lvl_select = YES THEN
   DO :
       UPDATE 
         lvc_part
         WITH FRAME a.
   END.
   ELSE
   DO:
      UPDATE 
        lvc_part1
        WITH FRAME a.
   END.
END.


Solution 1:[1]

DISPLAY and UPDATE work with the whole frame. UPDATE doesn't hide part of a frame just because you didn't update anything.

One way to get the result that you seem to want would be to HIDE the fields you don't want to see in your logic branch. Another would be to use two different frames.

Also - ATTR-SPACE was used to reserve space on screen for certain very old terminals from the 80s that had so little memory that they needed to spaces on the screen to store the start of attributes like REVERSE and UNDERLINE. These terminals were fondly referred to as "space wasters". Nobody actually makes such a thing anymore and I very seriously doubt that you are using an emulator that needs that attribute.

Solution 2:[2]

To hide lvc_part in the ELSE block, write

HIDE lvc_part IN FRAME a. 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tom Bascom
Solution 2 Mike Fechner