Showing posts with label Research. Show all posts
Showing posts with label Research. Show all posts

Tuesday, June 27, 2017

Refresh,Reread,Research,ExecuteQuery in dynamics AX

Refresh,Reread,Research,ExecuteQuery in dynamics AX
1. Refresh()
refreshes the user view with whats stored in the caches. This does not touch the DB.
Use this after any form change has been made through code.
2. ReRead()
 fetches only the current record from database and does not re read the complete datasource.
Use this when you need to update only the current record after modifying any value.
3 . ReSearch() 
  will execute the same query again and fetch the results from the database.
Use this if you need to get the current most data from database.
4 . ExecuteQuery()
 will run the query again just like research does but it will also take any query changes into account.
Use this is you have modified the query on run-time and need the updated results according to the new query.

Difference among Research() and Research(true) in AX 2012

Difference among Research() and Research(true) in AX 2012

Research
Calling research() will return the existing form query against the database, therefore updating the list with new/removed records as well as updating all existing rows. This will honor 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).