Sunday, February 7, 2021

X++ | Reread, refresh, research, and executeQuery

This is my personal memo for these datasource methods which was described very well by this following url. https://community.dynamics.com/365/supply-chain-management/b/axvanyakashperuk/posts/tutorial-58-refresh-reread-research-executequery-which-one-to-use-63

I rewrite it here because I found it's quite difficult to memorize the above concept. The reason is probably these methods are sharing somethings in common, then difficult to distinguish. 


Getting a latest value







Reread     Get the current record value from database to form datasource cache.

Refresh    Get the current record value from form datasource cache to form control.

Commonly used: reread() and then refresh()


Rerunning a form datasource query

Research            Rerun the form datasource query against the database with base query + user interface filters.

ExecuteQuery    Rerun the form datasource query against the database with base query + dev code.

In other words (below are copied directly from above url):

    1) Research - when the research method is called, a new instance of the queryRun is created, using the formDataSource.queryRun().query() as the basis. Therefore, if the user has set up some filters on the displayed data, those will be preserved. 

    2) ExecuteQuery - on the other hand, will use the original query formDataSource.query() as the basis, therefore removing any user filters.

No comments:

Post a Comment