✏️ Explanatory Question
The active() method is a standard method of a form data source that's called when a user navigates to a new record.
Example
You have a custom form with a table named TrainingMaster. The table has a field named Venue and an enum type field named TrainingType, which has two values of Online and Classroom. While you're navigating through the records, the Venue field will be uneditable if TrainingType is Online. Otherwise, the Venue field will be editable.
The code pattern should be as follows:
[DataSource]
class TrainingMaster
{
public int active()
{
int ret;
ret = super();
TrainingMaster_ds.object(fieldNum(TrainingMaster,
Venue)).allowEdit(TrainingMaster.TrainingType == TrainingType::Classroom);
return ret;
}
}