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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 02.03.2014, 15:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
axStart: Valid Time State Tables and Date Effective Data in combination with DMF and WCF (AIF)
Источник: http://www.axstart.com/valid-time-st...mf-and-wcf-aif
==============

The new index features in AX 2012 are nice, but in become tricky in combination with integrations like DMF or WCF.

DMF

The DMF wizard results duplicates the table to the DMF staging table with the same indexes, only 2 columns are added. When filling the staging tables , it work fine, unless you start pushing the data to the target, you get strange errors like:

Cannot edit a record in DMF**** (DMF****). Update on a valid time state table is not allowed without specifying a ValidTimeStateUpdateMode

You can solve this one by changing the index on the DMF**** table.  (DMF copies the table including the indexes.) Set the ValidTimeStateFieldType property to non (only possible on an empty table). Next add the from and to field manually to the index. So far so good, now we must make one more adaption so we can also update the target

public Common insertUpdate(Common _target, boolean _callInsertLogic = true, boolean _callValidateLogic= true)
{
Common ret;
if(_target.TableId == tableNum(****))
{
if(!target.ValidFrom)
{
target.ValidFrom = today();
}
if(!target.ValidTo)
{
target.ValidTo = dateMax();
}
target.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
_target.selectForUpdate(true);
_target.data(target);
}
ret = super(_target, _callInsertLogic, _callValidateLogic);
return ret;
}

WCF (AIF)

Even when you only create records in AIF , the framework also does updates. The consuming party gets errors like:
  • “The ‘Expiration’ value needs to be greater than or equal to the ‘Effective’ value.”
  •  “Update on a valid time state table is not allowed without specifying a ValidTimeStateUpdateMode”
  •  “Entity update mode cannot be specified”
You could solve this by setting the updateMode in the prepareForSave.

public boolean prepareForSaveExtended(
AxdStack _axBcStack,
  str _dataSourceName,
AxdRecordProcessingContext _recordProcessingContext,
AxInternalBase _childRecord)
{
AxMarkupAutoTable axbc_MarkupAutoTable;
switch (_dataSourceName)
{
// ———————————————————————-
        // Process MarkupAutoTable records
        // ———————————————————————-
       case #MarkupAutoTable_DataSourceName:
axbc_MarkupAutoTable = _axBcStack.top();
switch(_recordProcessingContext)
{
case AxdRecordProcessingContext::BeforeChildRecordProcessed:
if(axbc_MarkupAutoTable.currentRecord().RecId)
                  {
                     axbc_MarkupAutoTable.currentRecord().validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
}
return true;
}
default:
error(strfmt(“@SYS88979″,classId2Name(classidget(_axBcStack.top()))));
return false;
}
return false;
}



Источник: http://www.axstart.com/valid-time-st...mf-and-wcf-aif
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
За это сообщение автора поблагодарили: gl00mie (3).
 

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 12:30.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.