It is possible to pass a datasource bound to a grid in a class and then iterate like a query. In this post, I’ll giving some code snippets to work with form datasource in some other object like classes.
Your method or constructor of the class should be able to recieve FormDataSource type object. This class is used to handle a form datasource. You may send your datasource to this class’ object by other means like calling parm methods.
public void printOpenTransactions(FormDataSource _formDataSource)
Create a Query and QueryRun Objects by calling query() method of the datasource
Query query = _formDataSource.query();
QueryRun queryRun = new QueryRun(query);
Iterate through each record in datasource and get the table buffer to do further processing.
TableBuffer buffer = queryRun.get(tablenum(TableBuffer));
// do processing on buffer
One thought on “Manipulating a form datasource in a class.”
Does the processing on the buffer only apply to the buffer?
Comments are closed.