To Get Default Dimension
static void ShyamDEV_Dimension(Args _args)
{
SalesTable salesTable;
CustTable custTable = CustTable::find("1101");
DimensionAttributeValueSetStorage dimStorage;
Counter i;
DefaultDimensionView defaultDimensionView;
DimensionAttribute dimensionAttribute;
DimensionAttribute dimAttribute;
select firstOnly defaultDimensionView join salesTable
where defaultDimensionView.DefaultDimension == salesTable.DefaultDimension && salesTable.SalesId==whsWorkTable.OrderNum
join dimensionAttribute where defaultDimensionView.Name == dimensionAttribute.Name
&& defaultDimensionView.Name =="BusinessUnit" ; // Port in UAT
info(strFmt("%1 = %2",defaultDimensionView.Name,defaultDimensionView.DisplayValue));
info(strFmt("%1",defaultDimensionView.dimensionDiscription()));
}
To Get Custom Dimension
static void ShyamDEV_Dimension(Args _args)
{
SalesTable salesTable;
CustTable custTable = CustTable::find("1101");
DimensionAttributeValueSetStorage dimStorage;
Counter i;
DefaultDimensionView defaultDimensionView;
DimensionAttribute dimensionAttribute;
DimensionAttribute dimAttribute;
select firstOnly defaultDimensionView join salesTable
where defaultDimensionView.DefaultDimension == salesTable.DefaultDimension && salesTable.SalesId==whsWorkTable.OrderNum
join dimensionAttribute where defaultDimensionView.Name == dimensionAttribute.Name
&& defaultDimensionView.Name =="BusinessUnit" ; // Port in UAT
info(strFmt("%1 = %2",defaultDimensionView.Name,defaultDimensionView.DisplayValue));
info(strFmt("%1",defaultDimensionView.dimensionDiscription()));
}
To Get Custom Dimension
/// <summary>
/// Find description for custom financial dimension value
/// </summary>
/// <param name="_dimensionValue" />
/// Financial dimension value
/// </param>
/// <param name="_dimensionAttributeName" />
/// Dimension attribute name
/// </param>
/// <returns>
/// DimensionValue description
/// </returns>
/// <remarks>
/// Only for custom financial dimensions
/// </remarks>
public static Description findDimensionValueDescription(DimensionValue _dimensionValue, Name _dimensionAttributeName)
{
DimensionFinancialTag dimensionFinancialTag;
DimensionAttributeDirCategory dimensionAttributeDirCategory;
DimensionAttribute dimensionAttribute;
/// Find description for custom financial dimension value
/// </summary>
/// <param name="_dimensionValue" />
/// Financial dimension value
/// </param>
/// <param name="_dimensionAttributeName" />
/// Dimension attribute name
/// </param>
/// <returns>
/// DimensionValue description
/// </returns>
/// <remarks>
/// Only for custom financial dimensions
/// </remarks>
public static Description findDimensionValueDescription(DimensionValue _dimensionValue, Name _dimensionAttributeName)
{
DimensionFinancialTag dimensionFinancialTag;
DimensionAttributeDirCategory dimensionAttributeDirCategory;
DimensionAttribute dimensionAttribute;
select firstOnly Description from dimensionFinancialTag
where dimensionFinancialTag.Value == _dimensionValue
join DirCategory from dimensionAttributeDirCategory
where dimensionAttributeDirCategory.DirCategory == dimensionFinancialTag.FinancialTagCategory
join RecId from dimensionAttribute
where dimensionAttribute.RecId == dimensionAttributeDirCategory.DimensionAttribute
DimensionAttribute.Name == _dimensionAttributeName;
where dimensionFinancialTag.Value == _dimensionValue
join DirCategory from dimensionAttributeDirCategory
where dimensionAttributeDirCategory.DirCategory == dimensionFinancialTag.FinancialTagCategory
join RecId from dimensionAttribute
where dimensionAttribute.RecId == dimensionAttributeDirCategory.DimensionAttribute
DimensionAttribute.Name == _dimensionAttributeName;
return dimensionFinancialTag.Description;
}
}
Hi,
ReplyDeleteCan we get the same (value of financial dimension) from table DimensionAttributeValueCombination instead ?
Thanks,