Example 2: CONSTRUCT with binding by field name

Form definition file "form1.per":
SCHEMA office

LAYOUT
GRID
{
  Customer id: [f001    ]
  First Name : [f002                    ]
  Last Name  : [f003                    ]
} 
END
END

TABLES
  customer
END

ATTRIBUTES
  f001 = customer.id;
  f002 = customer.fname;
  f003 = customer.lname, UPSHIFT;
END

INSTRUCTIONS
  SCREEN RECORD sr_cust(customer.*);
END
Program source code:
SCHEMA office
MAIN
  DEFINE condition STRING
  DEFINE statement STRING
  DEFINE cust RECORD LIKE customer.*
    
  DATABASE office
  
  OPEN FORM f1 FROM "form1"
  DISPLAY FORM f1
    
  CONSTRUCT BY NAME condition ON customer.* 
    BEFORE CONSTRUCT
      DISPLAY "A*" TO fname 
      DISPLAY "B*" TO lname 
  END CONSTRUCT
    
  LET statement = 
    "SELECT fname, lname FROM customer WHERE " || condition 
  DISPLAY "SQL: " || statement 
    
  DECLARE c1 CURSOR FROM statement
  FOREACH c1 INTO cust.*
    DISPLAY cust.*
  END FOREACH

END MAIN