Here is the sample X++ code to find financial dimension value from the worker's primary position.
public Name getDimensionValue(HcmWorkerRecId _workerRecId, Name _DimensionName)
{
HcmPositionDefaultDimension hcmPositionDefaultDimension;
DefaultDimensionView dimensionView;
DimensionAttributeValueSet DimensionAttributeValueSet;
DimensionAttributeValueSetItem DimensionAttributeValueSetItem;
DimensionAttributeValue DimensionAttributeValue;
DimensionAttribute DimensionAttribute;
select HcmPositionDefaultDimension
where
HcmPositionDefaultDimension.Position == HcmWorker::getPrimaryPosition(_workerRecId);
select RecId from
DimensionAttributeValueSet
where DimensionAttributeValueSet.RecId ==
HcmPositionDefaultDimension.DefaultDimension
join RecId, DisplayValue,
DimensionAttributeValueSet from DimensionAttributeValueSetItem
where
DimensionAttributeValueSetItem.DimensionAttributeValueSet ==
DimensionAttributeValueSet.RecId
join RecId from
DimensionAttributeValue
where DimensionAttributeValue.RecId
== DimensionAttributeValueSetItem.DimensionAttributeValue
join RecId, Name,
ValueAttribute from DimensionAttribute
where
DimensionAttribute.RecId == DimensionAttributeValue.DimensionAttribute
&&
DimensionAttribute.Name == _DimensionName;
select dimensionView
where dimensionView.DefaultDimension ==
HcmPositionDefaultDimension.DefaultDimension
&& dimensionView.Name
== _DimensionName
&&
dimensionView.DisplayValue == DimensionAttributeValueSetItem.DisplayValue
&&
dimensionView.DimensionAttributeId == DimensionAttribute.RecId;
return
dimensionView.dimensionDiscription();
}
No comments:
Post a Comment