Understanding ezSDK VirtualFields
VirtualFields are custom page controls that can assume the properties of any record field and replace static fields in many applications. They are particularly useful in search applications where a small set of virtual fields can replace a much larger number of static fields.
The VirtualField SDK includes many Application Designer definitions and a PeopleCode API that significantly reduce the level of effort needed to develop applications leveraging VirtualFields.
VirtualFields are comprised of the following elements:
VirtualField Control Class Methods
In this section, we discuss each VirtualField Control class method. The methods are discussed in alphabetical order.
addFieldnameExclusions
Syntax
addFieldnameExclusions(Recname, FieldList)
Description
The addFieldnameExclusions method removes fieldnames from the Field Selector drop-down list.
Parameters
Field or Control | Definition |
Recname | Specify a record name. |
FieldList | Specify a comma-delimited list of field names. |
Returns
None.
Example
In the following example, fields VNDR_TIN and PROCESS_INSTANCE are removed from the VirtualField Field Selector drop-down list.
Local EZ_SDK_VFIELD:Control &VField;
&VField = create EZ_SDK_VFIELD:Control(EZVFLDDEMOWRK.EZ_FIELDNAME_01, True);
&VField.setRecnameDropDownItems(Record.VENDOR);
&VField.addFieldnameExclusions(Record.VENDOR, "VNDR_TIN,PROCESS_INSTANCE");
addFieldnameInclusions
Syntax
addFieldnameInclusions(Recname, FieldList)
Description
The addFieldnameInclusions method adds fieldnames to the Field Selector drop-down list.
Parameters
Field or Control | Definition |
Recname | Specify a record name. |
FieldList | Specify a comma-delimited list of field names. |
Returns
None.
Example
In the following example, the VirtualField Field Selector drop-down list is limited to: SETID, VENDOR_ID, and VENDOR_STATUS.
Local EZ_SDK_VFIELD:Control &VField;
&VField = create EZ_SDK_VFIELD:Control(EZVFLDDEMOWRK.EZ_FIELDNAME_01, True);
&VField.setRecnameDropDownItems(Record.VENDOR);
&VField.clearFieldnameInclusions(Record.VENDOR);
&VField.addFieldnameInclusions(Record.VENDOR, "SETID,VENDOR_ID,VENDOR_STATUS");
clear
Syntax
clear()
Description
The clear method resets a VirtualField Control to its default state.
Parameters
None.
Returns
None.
Example
Local EZ_SDK_VFIELD:Control &VField;
&VField = create EZ_SDK_VFIELD:Control(EZVFLDDEMOWRK.EZ_FIELDNAME_01, True);
&VField.setRecnameDropDownItems ("VENDOR");
&VField.clear();
clearFieldnameExclusions
Syntax
clearFieldnameExclusions(Recname)
Description
The clearFieldnameExclusions method returns excluded fieldnames for a record to the Field Selector drop-down list.
Parameters
Field or Control | Definition |
Recname | Specify a record name. |
Returns
None.
Example
Local EZ_SDK_VFIELD:Control &VField;
&VField = create EZ_SDK_VFIELD:Control(EZVFLDDEMOWRK.EZ_FIELDNAME_01, True);
&VField.setRecnameDropDownItems(Record.VENDOR);
&VField.clearFieldnameExclusions(Record.VENDOR);
clearFieldnameInclusions
Syntax
clearFieldnameInclusions(Recname)
Description
The clearFieldnameInclusions method removes all fieldnames for a record from the Field Selector drop-down list. This method is typically used in conjunction with the addFieldnameInclusions to limit Field Selector drop-down lists to just a few fields.
Parameters
Field or Control | Definition |
Recname | Specify a record name. |
Returns
None.
Example
Local EZ_SDK_VFIELD:Control &VField;
&VField = create EZ_SDK_VFIELD:Control(EZVFLDDEMOWRK.EZ_FIELDNAME_01, True);
&VField.setRecnameDropDownItems(Record.VENDOR);
&VField.clearFieldnameInclusions(Record.VENDOR);
deserialize
Syntax
deserialize(ParentNodeName, XMLString)
Description
The deserialize method restores the state of a VirtualField from information contained in an XML-formatted string.
Parameters
Field or Control | Definition |
ParentNodeName | Specify the name of the VirtualField parent node ion the XMLString parameter. |
XMLString | A XML-formatted string containing serialized VirtualField state information. |
Returns
None.
Example
Local EZ_SDK_VFIELD:Control &VField;
&VField = create EZ_SDK_VFIELD:Control(EZVFLDDEMOWRK.EZ_FIELDNAME_01, True);
&VField.deserialize("Document",&XMLString);
getWhereClause
Syntax
getWhereClause(Alias, Conjunction)
Description
The getWhereClause method returns a SQL statement consistent with the state of the VirtualField.
Parameters
Field or Control | Definition |
Alias | Specify a record alias if required. |
Conjunction | Specify the conjunction (and, or) with which to prefix the SQL statement. |
Returns
String.
Example
In the following example, a SQL WHERE clause is constructed by stepping through the VirtualField Registry and executing the getWhereClause method for each VirtualField.
Local Integer &c;
Local String &sWhere;
Local EZ_SDK_VFIELD:Registry &Registry;
&Registry = create EZ_SDK_VFIELD:Registry();
For &c = 1 To &oRegistry.PageControlCount
&sWhere = &sWhere | &oRegistry.getPageControl(&c).getWhereClause("", "and");
End-For;
register
Syntax
register()
Description
The register method adds the control to the VirtualField Registry.
Parameters
None.
Returns
None.
Example
Local EZ_SDK_VFIELD:Control &VField;
&VField = create EZ_SDK_VFIELD:Control(EZVFLDDEMOWRK.EZ_FIELDNAME_01, True);
&VField.setRecnameDropDownItems ("VENDOR");
&VField.register();
serialize
Syntax
serialize(ParentNodeName, XMLString)
Description
The serialize method saves the state of a VirtualField in an XML-formatted string.
Parameters
Field or Control | Definition |
ParentNodeName | Specify the name of the VirtualField parent node ion the XMLString parameter. |
XMLString | A XML-formatted string to which VirtualField state information is to be added. |
Returns
None.
Example
Local EZ_SDK_VFIELD:Control &VField;
&VField = create EZ_SDK_VFIELD:Control(EZVFLDDEMOWRK.EZ_FIELDNAME_01, True);
&VField.setRecnameDropDownItems(Record.VENDOR);
&VField.serialize("Document",&XMLString);
setOperatorNumDropDownItems
Syntax
setOperatorNumDropDownItems(XlatValueList, XlatName)
Description
The setOperatorNumDropDownItems method overrides the default list of numeric field operators with those specified.
Parameters
Field or Control | Definition |
XlatValueList | A comma-delimited list of numeric operator translate values. |
XlatName | The translate name to display, i.e. LONG or SHORT. |
Returns
None.
Example
Local EZ_SDK_VFIELD:Control &VField;
&VField = create EZ_SDK_VFIELD:Control(EZVFLDDEMOWRK.EZ_FIELDNAME_01, True);
&VField.setRecnameDropDownItems ("VENDOR");
&VField.setOperatorNumDropDownItems ("EQ,NE",”SHORT”);
setOperatorStrDropDownItems
Syntax
setOperatorStrDropDownItems(XlatValueList, XlatName)
Description
The setOperatorStrDropDownItems method overrides the default list of character field operators with those specified.
Parameters
Field or Control | Definition |
XlatValueList | A comma-delimited list of character operator translate values. |
XlatName | The translate name to display, i.e. LONG or SHORT. |
Returns
None.
Example
Local EZ_SDK_VFIELD:Control &VField;
&VField = create EZ_SDK_VFIELD:Control(EZVFLDDEMOWRK.EZ_FIELDNAME_01, True);
&VField.setRecnameDropDownItems ("VENDOR");
&VField.setOperatorStrDropDownItems ("EQ,IN",”SHORT”);
setRecnameDropDownItems
Syntax
setRecnameDropDownItems(RecordList)
Description
The setRecnameDropDownItems method defines the records displayed in the Record Selector drop-down list.
Parameters
Field or Control | Definition |
RecordList | A comma-delimited list of record names. |
Returns
None.
Example
Local EZ_SDK_VFIELD:Control &VField;
&VField = create EZ_SDK_VFIELD:Control(EZVFLDDEMOWRK.EZ_FIELDNAME_01, True);
&VField.setRecnameDropDownItems ("PO_HDR,PO_LINE");