Показать сообщение отдельно
Старый 29.02.2024, 10:13   #1  
Blog bot is offline
Blog bot
Участник
 
25,644 / 848 (80) +++++++
Регистрация: 28.10.2006
dynamicsaxinsight: D365FO: Get dimension display value in X++
Источник: https://dynamicsaxinsight.wordpress....ay-value-in-x/
==============

Purpose:

Demonstrate how can we get dimension display value in X++. This could be pretty handy when we need to display dimension display value on a custom form or an SSRS report for example.

Application:

Dynamics 365 for Finance and Operations

Solution:

You can use the following code to get the dimension display value by passing in default dimension RecId and dimension name string.

Code

/// /// Gets dimension display value. Feb 16, 24 MK/// /// /// Gets dimension display value by default dimension and dimension name./// public static DimensionValue getDimensionDisplayValue(RecId _defaultDimension, Name _dimName){ DimensionAttributeValueSetStorage dimStorage; dimStorage = DimensionAttributeValueSetStorage::find(_defaultDimension); return dimStorage.getDisplayValueByDimensionAttribute(DimensionAttribute::findByName(_dimName).RecId);}
Usage

For example, if you need to get cost center dimension value from a Purchase Order header, then you can get it by passing in the default dimension RecId of PurchTable and cost center dimension string.

#define.CostCenter("CostCenter")dimCostCenter = MAK_LedgerDimensionHelper::getDimensionDisplayValue(purchTable.DefaultDimension, #CostCenter);


Источник: https://dynamicsaxinsight.wordpress....ay-value-in-x/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.