Manipulating a form datasource in a class.
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.
Step 1:
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)
{
}
Step 2:
Create a Query and QueryRun Objects by calling query() method of the datasource
Query query = _formDataSource.query();
QueryRun queryRun = new QueryRun(query);
Step 3:
Iterate through each record in datasource and get the table buffer to do further processing.
while (queryRun.next())
{
TableBuffer buffer = queryRun.get(tablenum(TableBuffer));
// do processing on buffer
}
That’s it.
One thought on “Manipulating a form datasource in a class.”
Comments are closed.
Does the processing on the buffer only apply to the buffer?