AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 04.09.2008, 15:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,631 / 848 (80) +++++++
Регистрация: 28.10.2006
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, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
palleagermark: Shortcut to the query object of a form data source Blog bot DAX Blogs 1 07.01.2009 18:33
Не работает метод findValue on a form data source Morpheus DAX: Программирование 9 28.06.2006 08:55
Methods on a form data source rohlenko DAX: Программирование 2 17.06.2005 16:01
Перебор записей Form Data Source при множественном выборе maxsmirnov DAX: Программирование 1 24.05.2004 16:16
Говорят вышел SP2 для Axapta 3. Кто нибуть что знает на эту тему? soin DAX: Прочие вопросы 10 13.10.2003 10:43

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 21:25.