04.09.2008, 15:05 | #1 |
Участник
|
axStart: Change data on a data source on a Form
Источник: http://axstart.spaces.live.com/Blog/...C0A0!375.entry
============== When changing data by code in a form, developer gets these errors: - Message record has been changed by other user. - Focus of the current record is lost. - Changed data does not appear on the form. To understand these issues we must first understand the architecture of the Form. A Form has multiple data sources. These data sources do not have a relation like a query. The act like in depended queries, however we have the option to filter data with the information from a related data source. The advantage of in depended data sources is, that the can be stand alone refreshed. This refresh can be done with the command: reread (update current record in the data source with the actual database record.) or executeQuery (update the all records from the data source with the records of the database). You should only use executeQuery when other record in the data source is also updated. There is one disadvantage about executeQuery; the focus of the current record is lost. After a reread on a data source, a refresh is needed to update the information in the Form. Example: - If multiple sales line changes on the Sales Table Form use the executeQuery on the Sales Line data source. A lot of time developers use executeQuery on the Sales Table. This also triggers the Sales Line but generate overkill on data traffic. Changing data by code. You can change the value on the data source or change the data on the database table. By changing the code on the database table, an inconsistency between data source and table is created. When users, after this code, does some manual changes on the data source and updates the record, an error occurs that another user has changed the record. If you work in the next order of steps, these issues will not occur. · Datasource.write(); //store optional changes of that data · Update the table by code. · Use Data source. Reread or execute query to update the data source. In general if you only use code that changes the data source, live gets easy, but on the other hand, your Form gets business logic and that is always a bad case. Источник: http://axstart.spaces.live.com/Blog/...C0A0!375.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|