A code modification created the additional element _EmptyParent_, but DimensionElementComponentAdd(vDimName, vParent, vElem, vWeight) still doesn't work (see Dim_Tarif_Plan_3.PNG).
Code: Select all
vDimName = 'Tarif_Test';
vElem = Tarif;
vIndex = ELPARN(vDimName, vElem);
vParent = ELPAR(vDimName, vElem, vIndex);
vWeight = ELWEIGHT(vDimName, vParent, vElem);
IF (SUBST(vElem, 1, 5) @= 'VPPT_' % SUBST(vElem, 1, 3) @= 'PT_');
itemskip;
ELSEIF (SUBST(vElem, 1, 5) @= 'MPPT_');
DimensionElementInsert(vDimName, '', vElem, 'N');
ELSE;
DimensionElementInsert(vDimName, '', vElem, 'C');
ENDIF;
if (vParent @= '');
DimensionElementInsert(vDimName, '', '_EmptyParent_', 'N');
else;
DimensionElementComponentAdd(vDimName, vParent, vElem, vWeight);
endif;
Another code modification shows that vParent = ELPAR(vDimName, vElem, vIndex); ist probably the problem. It is allways empty. This code doesn't even create the consolidated elements, because it never jumps into the else - part (see Dim_Tarif_Plan_4.PNG). So how do I get the parents?
Code: Select all
vDimName = 'Tarif_Test';
vElem = Tarif;
vIndex = ELPARN(vDimName, vElem);
vParent = ELPAR(vDimName, vElem, vIndex);
vWeight = ELWEIGHT(vDimName, vParent, vElem);
IF (SUBST(vElem, 1, 5) @= 'VPPT_' % SUBST(vElem, 1, 3) @= 'PT_');
itemskip;
ELSEIF (SUBST(vElem, 1, 5) @= 'MPPT_');
DimensionElementInsert(vDimName, '', vElem, 'N');
ENDIF;
if (vParent @= '');
itemskip;
else;
DimensionElementInsert(vDimName, '', vElem, 'C');
DimensionElementComponentAdd(vDimName, vParent, vElem, vWeight);
endif;