Form file "form1.per":
LAYOUT ( TEXT = "Query customers", STYLE = "dialog3" )
GRID
{
<g g1 >
Id: [f1 ] Name: [f2 ]
State: [f3 ]
City: [f4 ]
Zip-code: [f5 ]
[ :cc :sr ]
< >
<g g2 >
<t t1 >
Id Name Timestamp
[c1 |c2 |c3 ]
[c1 |c2 |c3 ]
[c1 |c2 |c3 ]
[c1 |c2 |c3 ]
[c1 |c2 |c3 ]
[c1 |c2 |c3 ]
[c1 |c2 |c3 ]
[c1 |c2 |c3 ]
< >
< >
[ :cw ]
}
END
END
ATTRIBUTES
GROUP g1: TEXT = "Search criteria";
EDIT f1 = FORMONLY.cust_id TYPE INTEGER;
EDIT f2 = FORMONLY.cust_name TYPE VARCHAR;
COMBOBOX f3 = FORMONLY.cust_state TYPE VARCHAR,
QUERYEDITABLE, DEFAULT="CA", INITIALIZER=combo_fill_states;
BUTTONEDIT f4 = FORMONLY.cust_city TYPE CHAR, ACTION=zoom_city, IMAGE="find";
EDIT f5 = FORMONLY.cust_zip-code TYPE VARCHAR;
GROUP g2: TEXT = "Customer list";
EDIT c1 = FORMONLY.c_id TYPE INTEGER;
EDIT c2 = FORMONLY.c_name TYPE VARCHAR;
DATEEDIT c3 = FORMONLY.c_ts TYPE DATETIME YEAR TO SECOND;
BUTTON cc: clear, TEXT="Clear";
BUTTON sr: fetch, TEXT="Fetch";
BUTTON cw: close;
END
INSTRUCTIONS
SCREEN RECORD sr (FORMONLY.c_id THROUGH FORMONLY.c_ts);
END
Program file:
MAIN
DEFINE custarr DYNAMIC ARRAY OF RECORD
c_id INTEGER,
c_name VARCHAR(50),
c_ts DATETIME YEAR TO SECOND
END RECORD
DEFINE where_clause STRING
OPTIONS INPUT WRAP
OPEN FORM f1 FROM "form1"
DISPLAY FORM f1
LET custarr[1].c_id = 123
LET custarr[1].c_name = "Parker"
LET custarr[1].c_ts = CURRENT YEAR TO SECOND
LET custarr[2].c_id = 124
LET custarr[2].c_name = "Duran"
LET custarr[2].c_ts = CURRENT YEAR TO SECOND
DIALOG ATTRIBUTES(FIELD ORDER FORM, UNBUFFERED)
CONSTRUCT BY NAME where_clause
ON cust_id, cust_name, cust_state, cust_city, cust_zip-code
ON ACTION clear
CLEAR cust_id, cust_name, cust_state, cust_city, cust_zip-code
END CONSTRUCT
DISPLAY ARRAY custarr TO sr.*
BEFORE ROW
MESSAGE SFMT("Row: %1/%2", DIALOG.getCurrentRow("sr"),
DIALOG.getArrayLength("sr"))
END DISPLAY
ON ACTION fetch
DISPLAY where_clause
-- Execute SQL query here to fill custarr ...
ON ACTION close
EXIT DIALOG
END DIALOG
END MAIN