Wednesday, August 12, 2015

Differences between reread(), refresh(),research()


When working with Forms, commonly after opened the form we need to do some operations with existing data. In few cases we need to interact with data base again and again in order to do. For that we will use these methods. But some times its create confuse what exactly use of these methods, when should we call these methods and why, here is brief info these methods...

refresh() : this method will refresh the data in the data source cache. But it will not interact with the data base to fetch the new/updated record values. What ever values have fetched in the previous query will store in data source cache, this method will just refresh the data source cache only.

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()

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.

executeQuery() is another useful one.  It should be used if you have modified the query in your code and need to refresh the form.  It's like research() except it takes query changes into account.

No comments:

Post a Comment

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// &l...