The Dialog class / ui.Dialog methods |
Sets the value of a field controlled by the dialog object.
setFieldValue( name STRING, value fgl-type )
DEFINE default_address STRING, default_creadate DATE ... CALL d.setFieldValue( "customer.cust_addr", default_address ) CALL d.setFieldValue( "customer.cust_creadate", default_creadate )
The first parameter defines the field to be set.
In a dynamic dialog controlling a list of records (INPUT ARRAY / DISPLAY ARRAY), this method sets the value for a field in the current row. To fill the list of records before dynamic dialog execution, use setCurrentRow() to set the current row, then set field (cell values) with setFieldValue().
The following code example implements a FOR loop to copy values of all fields of the d_disparr dialog to the field of the d_recinp dialog:
DEFINE row, i INTEGER, h base.SqlHandle, fields DYNAMIC ARRAY OF RECORD name STRING, type STRING END RECORD, d_rec ui.Dialog, d_list ui.Dialog ... -- Fill the array with rows from an SqlHandle object CALL h.open() LET row = 0 CALL h.fetch() WHILE status == 0 -- must set the current row before setting values CALL d_list.setCurrentRow("sr_custlist", row:=row+1 ) FOR i = 1 TO h.getResultCount() CALL d_list.setFieldValue( h.getResultName(i), h.getResultValue(i) ) END FOR CALL h.fetch() END WHILE CALL h.close() CALL d_list.setCurrentRow("sr_custlist", 1) ... -- Copy field values from d_list to d_rec dialog FOR i=1 TO fields.getLength() CALL d_rec.setFieldValue( fields[i].name, d_list.getFieldValue( fields[i].name ) ) END FOR