In this blog we learn how to Get ledger dimension description beside dimension in d365fo x++
Step1)write a display method in table and give in formdatasource
logic:-
[ExtensionOf(tableStr(BudgetTransactionLine))]
internal final class DaxBudgetTransactionLine_Extension
{
public display str descriptionLedger()
{
str descriptionLedgerLoc = '';
boolean first = true;
DimensionAttributeLevelValueAllView view,viewloc;
DimensionAttributeValue dimValue;
DimensionAttributeValueGroup dimensionAttributeValueGroup;
container con;
select firstonly viewloc
where viewloc.ValueCombinationRecId==this.LedgerDimension;
while select view order by view.ValueOrdinal asc
where view.ValueCombinationRecId == this.LedgerDimension
&& view.DimensionAttributeValueGroup==viewloc.DimensionAttributeValueGroup
{
dimValue = DimensionAttributeValue::find(view.AttributeValueRecId);
if (!conFind(con,view.AttributeValueRecId))
{
con += [view.AttributeValueRecId];
if (dimValue)
{
if (!first)
{
descriptionLedgerLoc += " - ";
}
descriptionLedgerLoc += dimValue.getName();
first = false;
}
}
}
return descriptionLedgerLoc;
}
}
Output:-