AXForum  
Go Back   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Forgotten Your Password?
Register Forum Rules FAQ Members List Today's Posts Search Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Old 05.11.2012, 04:25   #1  
Blog bot is offline
Blog bot
Участник
 
25,646 / 848 (80) +++++++
Join Date: 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, напишите личное сообщение администратору.
 

Similar Threads
Thread Thread Starter Forum Replies Last Post
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Рейтинг@Mail.ru
All times are GMT +3. The time now is 23:56.
Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Contacts E-mail, Advertising.