There are two recommended practices for cleaning up after using datasets in your code:
  • DETACH-DATA-SOURCE
  • EMPTY-DATASET

DETACH-DATA-SOURCE

Generally, you should detach data-sources when you are done using them, unless you plan to populate or update the dataset later in the procedure.

The syntax to detach a data-source is:

buffer-handle:DETACH-DATA-SOURCE().

For example:

BUFFER ttOrder:DETACH-DATA-SOURCE().

EMPTY-DATASET

If you plan to empty and populate a dataset again, or if you no longer need the data in your dataset in memory, use the EMPTY-DATASET method to empty a dataset object of all records in its associated temp-tables.

Once the dataset is emptied using this method, you may continue to use the dataset in your application.

The syntax to use the EMPTY-DATASET method is:

DATASET dataset-name:EMPTY-DATASET(). 

In the following example code, the EMPTY-DATASET method is called on the dsOrderOrderline dataset, removing all records. The structure of the dataset is left intact so it can be populated again.

DATASET dsOrderOrderLine:EMPTY-DATASET().

See also

DETACH-DATA-SOURCE( ) method in ABL Reference

EMPTY-DATASET( ) method in ABL Reference

Other ProDataSet methods in Use ProDataSets