Tuesday, 22 January 2019

finanial dimension values for worker x++

static void getDefaultDimensionAttributeForWorker(Args _args)
{
DimensionAttributeValueSetStorage dimStorage;
HcmPositionDefaultDimension HcmPositionDefaultDimension;
DimensionAttribute DimensionAttribute;
DimensionAttribute dimAttr;
DimensionAttributeValue dimAttrValue;
Common common;
DictTable dictTable;
str Name;
str value;
HcmEmployment employement;
HcmWorker hcmWorker;
Counter i;

hcmWorker = HcmWorker::findByPersonnelNumber(“1297”); //pass required worker
employement = HcmEmployment::findByWorker(hcmWorker.RecId);

dimStorage = DimensionAttributeValueSetStorage::find(employement.DefaultDimension); //DefaultDimension

for (i=1 ; i<= dimStorage.elements() ; i++)
{
select firstonly dimAttrValue
where dimAttrValue.RecId == dimStorage.getValueByIndex(i)
join dimAttr
where dimAttr.RecId == dimAttrValue.DimensionAttribute;

if (dimAttr && dimAttrValue)
{
dictTable = new DictTable(dimAttr.BackingEntityType);
common = dictTable.makeRecord();

if (common.TableId)
{
select common where common.(dimAttr.KeyAttribute) == dimAttrValue.EntityInstance;
name = common.(dimAttr.NameAttribute);
value = common.(dimAttr.ValueAttribute);
}
}
info(dimAttr.Name +"—-" +value + "—-"+name);
}
}

No comments:

Post a Comment