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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 12.12.2008, 13:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
DynaMihamAX: Label import problem in Dynamics AX 4.0
Источник: http://dynamihamax.blogspot.com/2008...ics-ax-40.html
==============

Hi,

About introduction: This is my first post, and I hope, I'll be able to post regularly in the future. Actually it depends on whether I encountered something I think to be useful for others as well or not. My topic will be Dynamics AX and related experiences. Sorry for my english if it's bad, it's only my second language.

So, in medias res...

Lately we were facing a problem regarding failing label import from XPO files.
The scenario were always like this: DEV system -> Test system -> Live system
The label import from the DEV to the TEST worked fine in most cases, but from the Test to the Live, it was a different story. Even though that on the import form the new labels were set to be imported (and make new label as well), several labels lost during each import.
Last time, I managed to formalize the circumstances of the problem and today I found the bug in the system, which was responsible for this annoyance.

Here is the problem description: each time when the import would import labels which were next in the label-file (current last label is @FOO111, the one to be imported is @FOO112), and there were at least one label which was different in the import than in the system for the same label-file (eg., @FOO99), the content of the newly created labels lost (with the label itself, of course).

Today I was also experiencing this problem, and I took the time to hunt the bug down. Within ten minutes, I found and fixed it as well, the problem was in the importLabels() method in \Classes\SysImportElements.

I changed it to the following:

X++:
// AOSrunmode::Client
private str importLabels(LabelModuleId _labelModuleId)
{
    str     labelIdPack;
    LabelId newLabelId;
    ;

    if (importLabelLanguageSet.elements())
    {
        while select tmpImportLabel
// 2008.04.15 AttBa fix (label import annoyances) Begin
// Detailed problem report: in some cases the newly
// created labels (from import) got overwritten by the
// imported labels (from the same import process).
// Example: biggest labelid for FOO labelfile: @FOO419
// Labels to be imported: @FOO420, @FOO421
// Labels to be newly created: @FOO418, @FOO419
// Result with the old behaviour:
// 1. @FOO418 created with labelid @FOO420
// 2. @FOO419 created with labelid @FOO421
// 3. @FOO420 imported to labelid @FOO420
// 4. @FOO421 imported to labelid @FOO421
// Result with the new behaviour:
// 1. @FOO420 imported to labelid @FOO420
// 2. @FOO421 imported to labelid @FOO421
// 3. @FOO418 created with labelid @FOO422
// 4. @FOO419 created with labelid @FOO423
            order by SysImportLabelAction
//            index LabelIdx
// 2008.04.15 AttBa fix (label import annoyances) End
            exists join tmpImportAotLabel
                index PathLabelIdx
                where tmpImportAotLabel.LabelId == tmpImportLabel.LabelId
                exists join tmpImportAot
                    index PathIdx
                    where tmpImportAot.TreeNodePath == tmpImportAotLabel.TreeNodePath
                       && tmpImportAot.Import
                    {
                        switch (tmpImportLabel.SysImportLabelAction)
                        {
                            case SysAotImportLabelAction::CreateNewLabel:
                                newLabelId = '';
                                while select tmpSysLabel
                                    index LabelIdx
                                    where tmpSysLabel.LabelId == tmpImportLabel.LabelId
                                {
                                    if (importLabelLanguageSet.in(tmpSysLabel.Language))
                                    {
                                        newLabelId = sysImportLabel.importLabelInsert(_labelModuleId, tmpSysLabel.Language, tmpSysLabel.Label, tmpSysLabel.Description, newLabelId, tmpSysLabel.SysLabelApplModule);
                                    }
                                }
                                if (newLabelId)
                                {
                                    if (labelIdPack)
                                    {
                                        labelIdPack += ',';
                                    }
                                    labelIdPack +=  tmpImportLabel.LabelId + ',' + newLabelId;
                                }
                                break;
                            case SysAotImportLabelAction::DoNotImportLabel:
                                break;
                            case SysAotImportLabelAction::ImportLabel:
                                while select tmpSysLabel
                                    index LabelIdx
                                    where tmpSysLabel.LabelId == tmpImportLabel.LabelId
                                {
                                    if (importLabelLanguageSet.in(tmpSysLabel.Language))
                                    {
                                        sysImportLabel.labelModify(tmpSysLabel.Language, tmpSysLabel.LabelId, tmpSysLabel.Label, tmpSysLabel.Description, tmpSysLabel.SysLabelApplModule);
                                    }
                                }
                                break;
                            case SysAotImportLabelAction::UseExistingLabel:
                                if (labelIdPack)
                                {
                                    labelIdPack += ',';
                                }
                                labelIdPack +=  tmpImportLabel.LabelId + ',' + tmpImportLabel.ReplaceWithLabel;
                                break;
                        }
                    }
    }
    return labelIdPack;
}

I re-did the import and puff - our problems are gone, labels have been imported properly.
Hope you'll also find it useful. As usual: I'm not liable for any damage this code takes on your system, import it for your own responsibility in your test system, etc...</span>

Источник: http://dynamihamax.blogspot.com/2008...ics-ax-40.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Dynamics AX: Managing Your Supply Chain Using Microsoft Dynamics AX 2009 - Book Review Blog bot DAX Blogs 0 31.03.2009 23:06
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05
Inside Dynamics AX 4.0: Usage Scenarios Blog bot DAX Blogs 0 04.10.2007 05:15
Сергей Герасимов: Что нового в Microsoft Dynamics AX 4.0 Blog bot DAX Blogs 0 16.01.2007 11:00
Dynamics AX: Why Dynamics AX beats SAP Blog bot DAX Blogs 0 10.01.2007 23:15
Опции темы Поиск в этой теме
Поиск в этой теме:

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

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

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

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