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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 10.02.2010, 13:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
SysDictCoder: Intrinsic function weirdness
Источник: http://sysdictcoder.com/blog/intrins...ion-weirdness/
==============

Over at Dynamics Ax Daily I found a post about a compile error using tableNum() in a select statement.

As mentioned there, the following code doesn’t compile.

select extCodeTable where extCodeTable.ExtCodeTableId == tableNum(CompanyInfo) join extCodeValueTable where extCodeValueTable.ExtCodeId == extCodeTable.ExtCodeId;

The compiler chokes on the call to tableNum(). I was surprised to see this, as I could have sworn that I have used tableNum() in select statements before. As it turns out it does compile in some cases.

It compiles without the join.

select extCodeTable where extCodeTable.ExtCodeTableId == tableNum(CompanyInfo);

It also works if you add another where clause after tableNum().

select extCodeTable where extCodeTable.ExtCodeTableId == tableNum(CompanyInfo) && extCodeTable.RecId != 0 join extCodeValueTable where extCodeValueTable.ExtCodeId == extCodeTable.ExtCodeId;

And using a non-intrinsic function works too.

select extCodeTable where extCodeTable.ExtCodeTableId == str2int("1234") join extCodeValueTable where extCodeValueTable.ExtCodeId == extCodeTable.ExtCodeId;

This example doesn’t make much sense with regards to business logic but it does compile.

I’m guessing this is a bug in the compiler. As far as I can tell it only fails when you use an intrinsic function before a join clause. Until it’s fixed just use a variable or throw in another where clause to check for RecId != 0. Since all records have a RecId it won’t affect the results you get back. This happens in Ax 4.0 and 2009.

All intrinsic functions are listed on MSDN.



Источник: http://sysdictcoder.com/blog/intrins...ion-weirdness/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Старый 10.02.2010, 18:07   #2  
kashperuk is offline
kashperuk
Участник
Аватар для kashperuk
MCBMSS
Соотечественники
Сотрудники Microsoft Dynamics
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии 2011
Лучший по профессии 2009
 
4,361 / 2084 (78) +++++++++
Регистрация: 30.05.2004
Адрес: Atlanta, GA, USA
Да, и в 6ке его тоже не захотели фиксить. Так что, ребята, создавайте переменные.
Старый 11.02.2010, 09:13   #3  
gl00mie is offline
gl00mie
Участник
MCBMSS
Most Valuable Professional
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
3,684 / 5788 (200) ++++++++++
Регистрация: 28.11.2005
Адрес: Москва
Записей в блоге: 3
Цитата:
Сообщение от kashperuk Посмотреть сообщение
Да, и в 6ке его тоже не захотели фиксить.
Чем мотивируют?
Старый 11.02.2010, 11:44   #4  
kashperuk is offline
kashperuk
Участник
Аватар для kashperuk
MCBMSS
Соотечественники
Сотрудники Microsoft Dynamics
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии 2011
Лучший по профессии 2009
 
4,361 / 2084 (78) +++++++++
Регистрация: 30.05.2004
Адрес: Atlanta, GA, USA
Цитата:
Сообщение от gl00mie Посмотреть сообщение
Чем мотивируют?
There is an easy workaround
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
CRM Programmer: Upgrade of javascript function to hide "Add Existing ..." button Blog bot Dynamics CRM: Blogs 0 21.12.2009 20:05
CRM DE LA CREME! Some useful CRMform jscripts Blog bot Dynamics CRM: Blogs 0 02.09.2009 10:05
SysDictCoder: Changing properties of AOT objects in code Blog bot DAX Blogs 0 04.05.2009 20:05
daxmy: AOT Find function Blog bot DAX Blogs 0 17.08.2007 01:23
SysDictCoder: Moving the blog Blog bot DAX Blogs 1 05.07.2007 01:56

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

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

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