SetControlValue
Mon 01 January 2018Syntax
SetControlValue(Value, PageName, PageFieldName [, RowNumber] [, &Field])
Description
Use the SetControlValue function to set an override string on the current field so that it simulates an end user entering data.
When a page is refreshed after a PeopleCode program completes, each field value gets set from the buffer. However, if you use this function to specify an override string for a field, the value you specify is used instead of the value in the buffer. This value is inserted directly into the control on the page, as if the end user typed it in. The field buffer remains unchanged. All validations, FieldEdit and FieldChange PeopleCode run immediately.
This function can be used in the following scenario: Suppose you have a text field that has a menu pop-up associated with it. The end user can use a secondary page to select an item to be used for the value. From the menu PeopleCode, you can verify that the value is valid, but the field doesnât turn red and the end user can leave the field. This could potential mean saving the page with bad data. You can use this function after the secondary page is dismissed. This causes the same edits to be run as if the end user had typed in the value.
This function doesn't work for radio button or check box controls.
Parameters
Field or Control |
Definition |
---|---|
Value |
Specify an override value on the current field. This parameter takes a string value. |
pagename |
Specify the name of page where the field exists. |
pagefieldname |
Specify the page field name. This is not the name of the field. This is the name that is assigned to the field in Application Designer, on the page field properties. |
RowNumber |
Specify the row number of the field. The default value is 1 if this parameter isn't set. |
&Field |
Specify an already instantiated field object referencing the field you want to override. |
Note: If you want to set an override string for a field on the level 1 scroll for a page, you do not need to specify either a row number or a field object. However, if you want to set the override string for a field on either the second or third level scroll for a page, you must specify both a row number and a field object for SetControlValue to work.
Returns
None.