refresh()
Calling refresh This method basically refreshes the data displayed in the form controls with whatever is stored in the form cache for that particular data source record. Calling refresh() method will NOT reread the record from the database. So if changes happened to the record in another process, these will not be shown after executing.
reread()
This method will interact with the data base and runs the query against the data base in order to fetch the new/updated record values. But this will not show the updated values in the form until calling the refresh method. that means it will update the data source form cache only but not existing form control values. So it is better to call the methods as shown here, like reread and after refresh methods in order to fetch the new / updated values from the data base.
formDataSource.reread()
formDataSource.refresh()
formDataSource.refresh()
research()
Calling research will rerun the existing form query against the database,
therefore updating the list with new/removed records as well as updating
all existing rows. This will even update any existing filters and sorting on
the form,that were set by the user.
therefore updating the list with new/removed records as well as updating
all existing rows. This will even update any existing filters and sorting on
the form,that were set by the user.
research(true)
The research method starting with AX 2009 accepts an optional boolean argument _retainPosition. If you call research(true), the cursor position in the grid will be preserved after the data has been refreshed. This is an extremely useful addition, which solves most of the problems with cursor positioning (findRecord method is the alternative, but this method is very slow).
executeQuery()
Calling executeQuery() will also rerun the query and update/add/delete the rows in the grid. The difference in behavior from research is described below. executeQuery() should be used if you have modified the query in your code and need to refresh the form to display the data based on the updated query.
formDataSource.queryRun().query() vs formDataSource.query()
An important thing to mention here is that the form has 2 instances of the query object. 0ne is the original datasource query (stored in formDataSource.query()) and the other is the currently used query with any user filters applied (stored in formDataSource.queryRun().query()). When the researchmethod 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.
This is useful, for example, when multiple users work with a certain form, each user has his own filters set up for displaying only relevant data, and rows get inserted into the underlying table externally (for example, through AIF).
Calling executeQuery, on the other hand, will use the original query as the basis, therefore removing any user filters. This is a distinction that everyone should understand when using research/executeQuery methods in order to prevent possible collisions with the user filters when updating the query.