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. For more details about field name specification, see Identifying fields in dialog methods.
When used in a dynamic dialog controlling a list of records, this methods sets the value for a field in the current row. The current row can be set with the setCurrentRow() method. This is also true when filling the dynamic dialog with rows: You must first set the current row with setCurrentRow(), then set field (i.e. 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
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 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