you can check the below code in page sales order subform where shortcut dimensions are shown on the basis of different dimensions values selected in GL setup.
field(ShortcutDimCode3; ShortcutDimCode[3])
{
ApplicationArea = Dimensions;
CaptionClass = '1,2,3';
TableRelation = "Dimension Value".Code WHERE("Global Dimension No." = CONST(3),
"Dimension Value Type" = CONST(Standard),
Blocked = CONST(false));
Visible = DimVisible3;
trigger OnValidate()
begin
ValidateShortcutDimension(3);
end;
}
to setup like the above one now you need to define the caption likewise in codeunit 343 "Dimension CaptionClass Mgmt" you can have a look on this codeunit it will give you better idea to achive custom caption.