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.

Add yours

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: