Copy element attributes from one dimension to another
Posted: Fri Jan 24, 2020 3:33 pm
Hello,
I have a dimension "Company_BU" where each BU is rolled up into a company. another dimension "BU" has only the BUs not company. I need to copy the Alias attributes of the "Company_BU" dimension to the "BU" dimension. I found some codes on this forum but my dimensions have different levels. I'm not sure how to deal with control cubes (with normal cubes I would create a view and copy data over but doesn't seem to work here).
in the TI, I had a subset named "BU" as data source, which includes level-zero-only elements in the Company_BU dimension (probably this part is wrong already?).
these are the codes provided on this forum, I don't know how to tweak it to suit my purpose here. Thank you so much in advance!
cDimF = 'Company_BU';
cDimT = 'BU';
cDimA= '}ElementAttributes_' | cDimF;
iAttr = DIMSIZ(cDimA);
i=1;
WHILE (i <= iAttr);
vType= SUBST(DTYPE(cDimA, DIMNM(cDimA, i)),2,1);
ATTRINSERT(cDimT, '', DIMNM(cDimA, i), vType);
AttrPuts(DIMNM(cDimA, i), cDimT, vBU, 'Name');
i=i+1;
END;
I have a dimension "Company_BU" where each BU is rolled up into a company. another dimension "BU" has only the BUs not company. I need to copy the Alias attributes of the "Company_BU" dimension to the "BU" dimension. I found some codes on this forum but my dimensions have different levels. I'm not sure how to deal with control cubes (with normal cubes I would create a view and copy data over but doesn't seem to work here).
in the TI, I had a subset named "BU" as data source, which includes level-zero-only elements in the Company_BU dimension (probably this part is wrong already?).
these are the codes provided on this forum, I don't know how to tweak it to suit my purpose here. Thank you so much in advance!
cDimF = 'Company_BU';
cDimT = 'BU';
cDimA= '}ElementAttributes_' | cDimF;
iAttr = DIMSIZ(cDimA);
i=1;
WHILE (i <= iAttr);
vType= SUBST(DTYPE(cDimA, DIMNM(cDimA, i)),2,1);
ATTRINSERT(cDimT, '', DIMNM(cDimA, i), vType);
AttrPuts(DIMNM(cDimA, i), cDimT, vBU, 'Name');
i=i+1;
END;