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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 06.03.2019, 21:13   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
Computed column for union values from multiple outer joined data sources in view
Источник: http://alexvoy.blogspot.com/2019/03/...lues-from.html
==============

Let's say you have a multiple outer joined data sources with similar fields, which can be merged by union to one target field.

PSAActualEntity data entity(in D365)can be a good example, if you add ProjCostTrans, ProjItemTrans, and ProjEmplTrans to its root data source table ProjTransPosting, which has appropriate relations to each of them.



All aforementioned have CategoryId field, which can be present in one table only at a time.


Let's place a new computed string field with the following static method with a nested if.


private static server str transCategoryId()
{
str sRet;
tableName viewName = identifierStr(avrPSAActualEntity);
str cCategoryProjCostTrans = SysComputedColumn::comparisonField(viewName,
identifierStr(ProjCostTrans),
fieldStr(ProjCostTrans, CategoryId));
str cCategoryProjItemTrans = SysComputedColumn::comparisonField(viewName,
identifierStr(ProjItemTrans),
fieldStr(ProjItemTrans, CategoryId));
str cCategoryProjEmplTrans = SysComputedColumn::comparisonField(viewName,
identifierStr(ProjEmplTrans),
fieldStr(ProjEmplTrans, CategoryId));
str sCategoryProjCostTrans = SysComputedColumn::returnField(viewName,
identifierStr(ProjCostTrans),
fieldStr(ProjCostTrans, CategoryId));
str sCategoryProjItemTrans = SysComputedColumn::returnField(viewName,
identifierStr(ProjItemTrans),
fieldStr(ProjItemTrans, CategoryId));
str sCategoryProjEmplTrans = SysComputedColumn::returnField(viewName,
identifierStr(ProjEmplTrans),
fieldStr(ProjEmplTrans, CategoryId));
sRet =
SysComputedColumn::if(SysComputedColumn::isNotNullExpression(cCategoryProjCostTrans),
cCategoryProjCostTrans,
SysComputedColumn::if(SysComputedColumn::isNotNullExpression(cCategoryProjItemTrans),
sCategoryProjItemTrans,
SysComputedColumn::if(SysComputedColumn::isNotNullExpression(cCategoryProjEmplTrans),
sCategoryProjEmplTrans,
SysComputedColumn::returnLiteral('')
)
)
);

return sRet;
}






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

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
stephenmann: Technical History of Dynamics AX - From Axapta 3.0 to AX2012 Blog bot DAX Blogs 5 03.03.2017 10:22
atinkerersnotebook: Using PowerPivot to Analyze Dynamics AX Data Blog bot DAX Blogs 1 05.10.2013 07:23
atinkerersnotebook: Walkthrough & Tutorial Summary Blog bot DAX Blogs 1 09.09.2013 09:11
atinkerersnotebook: Using Power BI to Visualize Customer Saturation Blog bot DAX Blogs 1 07.08.2013 08:11
wiki.dynamicsbook: Changes Made in Navision Attain 3.60 Blog bot Dynamics CRM: Blogs 0 02.09.2008 13:23

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

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

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