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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 18.06.2009, 15:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
axaptapedia: Trap typecast
Источник: http://www.axaptapedia.com/Trap_typecast
==============

Summary: caution trap in implicit typecast int64 to boolean

== Typecast from int64(RecId) to boolean ==
(tested in DynamicsAX 2009)

the implicit typecast from int/int64 to boolean is often used in ax sources...

select * from table where table.field == blabla
if (table.recid)


public boolean exist( EDT _value)
{
return (select * from table where table.field == _value).recId;
}


BUT.....

when the RecId (as 64bit integer) last 8 bits are 0
the typecast results in a false even though the RecId is not 0

so, take a look at the bestpractice (design patterns for table exist method)

'''when you'll need a boolean, than use a boolean expression !!!'''

if (table.RecId != 0)












[[category:caution trap]]


Источник: http://www.axaptapedia.com/Trap_typecast
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Теги
ax2009, ax4.0, int64, recid, баг, приведение типов, ядро

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
axaptapedia: Tutorial Password Blog bot DAX Blogs 1 22.05.2009 21:23
axcoder: PowerShell + Ax Blog bot DAX Blogs 1 09.01.2009 18:05
axaptapedia: Load Web Documents Blog bot DAX Blogs 1 03.01.2009 23:50
axcoder: AxPath is supported by axaptapedia Blog bot DAX Blogs 0 11.05.2007 10:00

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

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

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