Hi Friends,
The following job will get a DimensionAttributeValueSet record ID base on the a set of dimension values.
static void BSRK_DIM_Make_DefaultFinancialDimXPP(Args _args)
{
DimensionAttributeValue dimAtrrDepValue,dimAtrrLegalEntityValue,dimAtrrWorkerValue;
DimensionAttribute dimAtrrDep,dimAtrrLegalEntity,dimAtrrWorker;
DimensionAttributeValueSetStorage davss;
HcmPositionDefaultDimension positionDefaultDimension;
DefaultDimensionView defaultDimensionViewLE,defaultDimensionViewWorker;
str companyLegalEntity,departmentNo;
HcmPersonnelNumberId personnelNumberId;
positionDefaultDimension = HcmPositionDefaultDimension::findByPositionLegalEntity(5637198579,CompanyInfo::find().RecId);
select DisplayValue from defaultDimensionViewWorker
where defaultDimensionViewWorker.DefaultDimension == positionDefaultDimension.DefaultDimension
&& defaultDimensionViewWorker.name == 'Department';
select DisplayValue from defaultDimensionViewLE
where defaultDimensionViewLE.DefaultDimension == positionDefaultDimension.DefaultDimension
&& defaultDimensionViewLE.name == 'LegalEntity';
departmentNo = defaultDimensionViewWorker.DisplayValue;
companyLegalEntity = defaultDimensionViewLE.DisplayValue;
personnelNumberId = HcmWorker::find(5637203085).PersonnelNumber;
davss = DimensionAttributeValueSetStorage::find(positionDefaultDimension.DefaultDimension);
dimAtrrDep = DimensionAttribute::findByName('Department');
dimAtrrLegalEntity = DimensionAttribute::findByName('LegalEntity');
dimAtrrWorker = DimensionAttribute::findByName('Worker');
dimAtrrDepValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAtrrDep,departmentNo,false,true);
dimAtrrLegalEntityValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAtrrLegalEntity,companyLegalEntity,false,true);
dimAtrrWorkerValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAtrrWorker,personnelNumberId,false,true);
if(dimAtrrDepValue || dimAtrrLegalEntityValue || dimAtrrWorkerValue)
{
davss.addItem(dimAtrrDepValue);
davss.addItem(dimAtrrLegalEntityValue);
davss.addItem(dimAtrrWorkerValue);
ttsBegin;
positionDefaultDimension = HcmPositionDefaultDimension::findByPositionLegalEntity(5637198579,CompanyInfo::find().RecId,true);
positionDefaultDimension.DefaultDimension = davss.save();
positionDefaultDimension.update();
ttsCommit;
}
}
Nice article. This is more helpful.
ReplyDeleteVisual FoxPro to .Net
VB.Net Migration
VB6 Migration