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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 05.11.2012, 04:25   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
sashanazarov: Computed columns in Views by example
Источник: http://sashanazarov.blogspot.com/201...y-example.html
==============

There is a bug in the standard AX, in the query named AxdPurchaseRequisition. The problem is here:


PurchLineAllVersions datasource is based on a View object, so PurchLineAllVersions.TableId contains table ID of the view itself, and not that of the underlying tables. As a result, no DocuRefTrans records will be found with this quiry.

The issue may be fixed by using computed columns in views - the new feature in AX 2012.

As you may already know, the PurchLineAllVersions view is based on the quiry PurchLineAllVersions, which, in turn, is a union of 2 other views: PurchLineArchivedVersions and PurchLineNotArchivedVersions.

First, add a method to the 2 views.

PurchLineNotArchivedVersions:

public static server str purchLineTableId()
{
return SysComputedColumn::returnLiteral(tableNum(PurchLine));
}
PurchLineArchivedVersions:

public static server str purchLineTableId()
{
return SysComputedColumn::returnLiteral(tableNum(PurchLineHistory));
}
Add a column to the 2 views: right-click on the Fields, then "New -> Int Computed Column". Set the new fields' properties like that:


Then, add new PurchLineTableId fields to the PurchLineAllVersions query datasources and the PurchLineAllVersions view.

Finally, change the faulty link in the AxdPurchaseRequisition quiry, so that it will connect PurchLineAllVersions.PurchLineTableId and DocuRefTrans.RefTableId.

By the way, there is another, better example of how computed columns may be used: take a look at the InventValue* views, which are used by the Inventory Value report.


Источник: http://sashanazarov.blogspot.com/201...y-example.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
daxmusings: Computed View Columns in AX 2012 Blog bot DAX Blogs 5 19.10.2011 13:55
axinthefield: Data Management Views used in Performance Analyzer for Microsoft Dynamics Blog bot DAX Blogs 0 13.06.2011 00:11
Microsoft Dynamics CRM Team Blog: Working with System Views and Related Entities Blog bot Dynamics CRM: Blogs 0 02.03.2010 00:06
crmdude: Modifying Views outside Microsoft CRM Blog bot Dynamics CRM: Blogs 0 28.09.2009 03:14
mscrm4ever: CRM 4.0 Public View Manager Wizard (Hiding Views) Blog bot Dynamics CRM: Blogs 1 02.03.2009 09:42

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

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

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