Views can be used to query and manipulate data contained in a DatasetModel class without the requirement to populate the Model from the backend each time.
Creating a new instance of a View
To create an instance of a View we just need to call the CreateView method of the TableModel class of a DatasetModel. It returns a new instance of the same TableModel but with ModelType ViewModel property of type Consultingwerk.OERA.TableModelTypeEnum.
DEFINE VARIABLE oCustomerView AS Test.ModelClasses.CustomerTableModel NO-UNDO.
oCustomerView = oCustomerDatasetModel:Customer:CreateView ().
Applying a filter to the View
Due to the fact that a View is a TableModel, the filtering is done in the same way as filtering on the original TableModel/DatasetModel. The only difference is that calling the Fill method will only open a Query on the data already contained in the Model and not cause data to be retrieved from the backend.
Each TableModel instance has a property called “Filter” that references a specialized filter class for the table. These filter classes provide an individual property per field that allows you to define queries in a describing manner.