Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Finds the specified value in the data source and makes the record that has that value the current record that uses the FormDataSource.findRecord method.
Syntax
public boolean findValue(FieldId field, str value)
Run On
Client
Parameters
- field
Type: FieldId Extended Data Type
The field to search.
- value
Type: str
The value to find.
Return Value
Type: boolean
true if the value is found; otherwise, false.
Remarks
This method is called when a user clicks FindValue in the shortcut menu on a form control.
The findValue method can be overridden on a form data source by right-clicking the Methods node under the data source, pointing to Override Method, and then clicking findValue.
Examples
The following example stores the ID of the current record before it tries to modify data. If the update fails, the data source is positioned on the original record.
void clicked()
{
DocuTypeId docuTypeId;
RecId activeRecId;
;
// Store current RecID
activeRecId = docuRef.RecId;
// Open the Document Type dialog.
docuTypeId = smmDocuments::getDocuTypeId(element.args().record());
try
{
ttsbegin;
if (docuTypeId)
{
// Create a new document record
docuRef_ds.create();
docuRef.RefTableId = tableReference;
docuRef.RefRecId = recReference;
docuRef_ds.write();
super();
}
ttscommit;
}
catch
{
// Focus moved back to original record if there is an error
docuRef_ds.executeQuery();
docuRef_ds.findValue(fieldnum(DocuRef,RecId),
int642str(activeRecId));
}
}