Thursday, June 16, 2011

Some more Business Component Methods

ActivateMultipleFields
Property set containing a collection of properties representing the fields that are to be activated

SetMultipleFieldValues assigns a new value to the fields specified in the property set for the current row of the business component.

GetMultipleFieldValues returns values for the fields specified in the property set.

Code
var ContactBO = TheApplication().GetBusObject("Contact");
var ContactBC = ContactBO.GetBusComp("Contact");
with (ContactBC)
{
SetViewMode(AllView);
var fieldsPS = TheApplication().NewPropertySet();
var valuesPS = TheApplication().NewPropertySet();
fieldsPS. SetProperty("Last Name", "");
fieldsPS.SetProperty("First Name", "");
ActivateMultipleFields(fieldsPS);
ClearToQuery();
ExecuteQuery();
if (FirstRecord())
{
GetMultipleFieldValues(fieldsPS, valuesPS);
var slName = valuesPS.GetProperty("Last Name");
var sfName = valuesPS.GetProperty("First Name");
}
}




GetFormattedFieldValue Method

A string containing the value of the requested field, in the same format as displayed in the user interface, or an empty string ("") if the field is inactive or empty.


Usage
GetFormattedFieldValue is useful for code that is used in multiple countries with different formats for currency, date, and number. This method can be used only on fields that have been activated using ActivateField.

Some special behavior is associated with particular data types.

No comments:

Post a Comment