20.12.2008, 12:08 | #1 |
Участник
|
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, напишите личное сообщение администратору. |
|
21.12.2008, 01:17 | #2 |
Участник
|
Иными словами, это примерно такая же дыра, как в обозревателе таблиц, которому тоже можно помимо банального select * from <table> скармливать целые job'ы (главное - без последней ';')...
|
|
|
За это сообщение автора поблагодарили: Gustav (3). |