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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 20.12.2008, 12:08   #1  
Blog bot is offline
Blog bot
Участник
 
25,538 / 847 (80) +++++++
Регистрация: 28.10.2006
X++: Using the Cross company feature from the Business Connector and table browser.
Источник: http://blogs.msdn.com/x/archive/2008...e-browser.aspx
==============

In Ax 2009 the new cross company feature was introduced. It allows the programmer to specify a container containing strings denoting company names to the crosscompany hint:

container c = ['dat', 'dmo'];
select crosscompany: c * from custtable where custtable.Name == "Jones";

That is all very well in X++, of course, but how do you handle it when accessing data through the business connector?

The first approach would be to do something like the following:

AxaptaRecord r = axapta.CreateAxaptaRecord("CustTable");
ax.ExecuteStmt("select crosscompany: ['dmo', 'dat'] * from %1 where %1.Name == 'Jones'", r);

However, that will not work: The argument to the crosscompany hint is not an expression of type container, it is a variable of type container. Hence you cannot provide arbitrary expressions, only variable references. This was done to make the implementation of the feature simpler.

The solution lies in the realization that the string that enters the ExecuteStmt is actually entered into a function that is compiled and executed at runtime. There are no limits to what can be expressed in this string, as long as it is legal X++ statements.

So, consider doing:

AxaptaRecord r = axapta.CreateAxaptaRecord("CustTable");
ax.ExecuteStmt("container c = ['dmo', 'dat']; select crosscompany: c * from %1 where %1.Name == 'Jones'", r);

which would actually work.

Use the same trick when you use the table browser to look at records from Ax.











Источник: http://blogs.msdn.com/x/archive/2008...e-browser.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 


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

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

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