Sometimes, without much thinking we tend to change query of a form data sorce this way :
1. Put in the init method of datasource, after super() the range that will be applied to that table’s datasource.
2. Let the system retrieve the default query.
3. In the run method, which is after system generated query is executed, apply the range and then call the datasource.executeQuery again.
This is inefficient because of two things :
1. The data source query is executed two times, in which the first one is never used. This is a waste of resource.
2. When this form is a master table, go to main table will not work with this approach because go to main table is erased by the second exec ute query.
Better approach will be to follow standard AX InventJournalTable, where range query is applied before super() in the datasource.executeQuery method.
This will make sure only one execute query is needed (which is more efficient) as well as it will regard the go to main table.
First blog post
8 years ago