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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 08.02.2012, 01:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
emeadaxsupport: 3. Solving Fill Utility errors on Microsoft Dynamics AX 2012 - Error executing code: Wrong argument types for comparison
Источник: http://blogs.msdn.com/b/axsupport/ar...omparison.aspx
==============

Scenario:
A user wishes to update the Item group for a released product.

They right-click on the Item group field and selects the Record Info menu item.

In the Record information form they click the Fill Utility button.

We get the following error:

Error executing code: Wrong argument types for comparison.Stack trace

(C)\Forms\SysFillUtility\Methods\initializeMainQuery - line 61

(C)\Forms\SysFillUtility\Methods\init - line 53

....








What happened?
In this case, the error was caused by the fact that the primary field of the table (the table that the field belongs to that they wanted to change) is not of type string.



What did we do to resolve this?

1. First we found what the tableid was by doing some x++ debugging. Put a breakpoint for example on method at the top of the stack in line 61. When the code stops, after closing the stack trace window, in this method you can find there a variable called tableid. Note the value.

2 Several methods can be used to then convert the tableid to a table name, see http://msdn.microsoft.com/en-us/libr...(v=AX.50).aspx for more information onhow to use tablename2id x++ function.

3 In the AOT, we located our table

4. and found the PrimaryIndex property



5. In our case the the value of this property was set to SurrogateKey and that means RecId.

6. So In general, to fix this, we found what the field type is and added a line to the ‘InitializeMainQuery’ method of the SysFillUtillity form.

To fix our error, the following if clause was added in Forms\ SysFillUtillity\ InitializeMainQuery:

...
else if (mainTablePrimaryField)
{
if (!queryBuildRange)
{
if(mainTablePrimaryField==65534)
qbds.addRange(mainTablePrimaryField).value(int642str(formDataSource.cursor().(mainTablePrimaryField)));
else
qbds.addRange(mainTablePrimaryField).value(formDataSource.cursor().(mainTablePrimaryField));
}
else

...


Disclaimer:
This programming example is for illustration purposes only. Microsoft disclaims all warranties and conditions with regard to use of the programming example for other purposes. Microsoft shall not, at any time, be liable for any special, direct, indirect or consequential damages, whether in an action of contract, negligence or other action arising out of or in connection with the use or performance of the programming example. Nothing herein should be construed as constituting any kind of warranty.





Other related articles:

1. Solving Fill Utility errors on Microsoft Dynamics AX 2012 - SysDictFieldGroup object not initialized

2. Solving Fill Utility errors on Microsoft Dynamics AX 2012 - Fill Utility incorrectly updates a field that is not in the field list of the main datasource

4. Solving Fill Utility errors on Microsoft Dynamics AX 2012 - Error executing code: Wrong argument types for comparison (another scenario)




--author:Erco van Harn--reviewer:Mansour Yahya Mohamad Mansour












Источник: http://blogs.msdn.com/b/axsupport/ar...omparison.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Старый 08.02.2012, 08:53   #2  
gl00mie is offline
gl00mie
Участник
MCBMSS
Most Valuable Professional
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
3,684 / 5788 (200) ++++++++++
Регистрация: 28.11.2005
Адрес: Москва
Записей в блоге: 3
Цитата:
Сообщение от Blog bot Посмотреть сообщение
X++:
if (mainTablePrimaryField==65534)
    qbds.addRange(mainTablePrimaryField).value(int642str(formDataSource.cursor().(mainTablePrimaryField)));
else
    qbds.addRange(mainTablePrimaryField).value(formDataSource.cursor().(mainTablePrimaryField));
Мда, зашивать в код идентификаторы полей, да еще и в системе с якобы installation-specific IDs - это красиво... А queryValue() в 2012-й уже отменили?
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
dynamics-ax: Microsoft Dynamics AX 2012 Eventing - a look with X++ Blog bot DAX Blogs 18 26.08.2013 02:46
rumicrosofterp: Dynamics AX на Convergence 2012 Blog bot Microsoft и системы Microsoft Dynamics 0 13.01.2012 11:11
emeadaxsupport: Installation of Microsoft Dynamics AX 2009 or 2012 client may fail on a Microsoft Windows 7 x64 (64-bit operating system) Blog bot DAX Blogs 0 20.09.2011 23:12
dynamics-ax: Microsoft Dynamics AX 2012, OData and EDM Blog bot DAX Blogs 0 02.02.2011 07:11
Developer for Microsoft Dynamics AX Certification Roadmap Blog bot DAX Blogs 1 13.05.2009 16:17
Опции темы Поиск в этой теме
Поиск в этой теме:

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

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

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

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