Getting Dimension Name from dimension Code

By | February 7, 2018

It may be required to show dimension name in reports instead of the less explanatory dimension code. This may be a recurring requirement. Here is how to do it.

First create a variable DimensionValueRec variable of type record and subtype Dimension Value ( table )

Name Datatype Subtype Length
DimensionValueRec Record Dimension Value

Create a variable of name DimensionCode of dataype Code

Name Datatype Subtype Length
DimensionCode Code 20

Create a variable of name DimensionCodeName of type Text and length 50

Name Datatype Subtype Length
DimensionCodeName Text 50

Dimension can be retrieved using the following C/AL code.

DimensionValueRec.SETRANGE( Indentation, 1 );
DimensionValueRec.SETRANGE( Code, DimensionCode);
 DimensionCodeName := DimensionValueRec.Name
 DimensionCodeName := '';


Leave a Reply

Your email address will not be published. Required fields are marked *