CONSTRUCT programming steps
Follow this procedure to use the CONSTRUCT dialog
instruction.
To implement a CONSTRUCT statement:
-
Declare a variable with the
DEFINEstatement, it can beCHAR,VARCHARorSTRING.STRINGis preferred in order to avoid any size limitation. -
Open and display the form, using an
OPEN WINDOW WITH FORMor anOPEN FORM/DISPLAY FORMinstruction. -
Set the
int_flagvariable toFALSE. -
Define the
CONSTRUCTblock with the list of form fields to be used for the query by example. If needed, define dialog control blocks to implement rules for the query by example. -
Inside the
CONSTRUCTstatement, control the behavior of the instruction withBEFORE CONSTRUCT,BEFORE FIELD,AFTER FIELD,AFTER CONSTRUCTandON ACTIONblocks. -
After the interaction statement block, test the
INT_FLAGpredefined variable to check if the dialog was canceled (INT_FLAG=TRUE) or validated (INT_FLAG=FALSE).If theINT_FLAGvariable isTRUE, you should reset it toFALSEto not disturb code that relies on this variable to detect interruption events from the GUI front-end or TUI console. - To build the complete SQL statement, concatenate "
SELECT ... WHERE" to the string variable that contains the boolean SQL expression produced byCONSTRUCT. -
Define a database cursor with the
DECLARE FROMinstruction, by using theSELECTstatement. -
Execute the cursor and fetch the rows found by the database server. You can for example
implement a
FOREACHloop to fill a program array, to be shown by aDISPLAY ARRAYstatement.