✏️ Explanatory Question
The init() method is a standard method of a form data source, which is called when a form is opened after the implementation of the form init() method. This method helps create a data source query based on the data source properties.
Example
You have a custom form with a table named TrainingMaster. The table has an enum type field named TrainingType that has two values: Online and Classroom. The form should be opened with those records, where TrainingType is Online.
The code pattern should be as follows:
[DataSource]
class TrainingMaster
{
public void init()
{
super();
this.query().dataSourceName("TrainingMaster")
.addRange(fieldNum(TrainingMaster,TrainingType))
.value(enum2Str(TrainingType::Online));
}
}