Populating attribute counter
Posted: Tue Mar 02, 2021 5:45 pm
Hey, so i have an interface whcih allows users to input items which will be added to a dimension,
I have in my control cube an element called "Sequence" with a numeric value of 1. I have an attribute in the dimension called "ID"
now when the TI runs I want to take that 1 and make it the ID for the first element, then add 1 to the current "Sequence numeric value"
so if the user adds 3 items in the interface i want item 1 to have ID 1, item 2 ID 2, item 3 ID "3". and in the control cube the sequence will now contain "4"
this is what my METADATA tab has, originally i had all of
in the data tab.
when in data i got an error which was trying to populate all the elements with the same ID
when in metadata i got the error that any element after the first one i not foun in the dimension (even though when I checked it was being added)
I have in my control cube an element called "Sequence" with a numeric value of 1. I have an attribute in the dimension called "ID"
now when the TI runs I want to take that 1 and make it the ID for the first element, then add 1 to the current "Sequence numeric value"
so if the user adds 3 items in the interface i want item 1 to have ID 1, item 2 ID 2, item 3 ID "3". and in the control cube the sequence will now contain "4"
Code: Select all
sElem = TRIM(vVal);
IF(sElem @= '' );
ITEMSKIP;
ENDIF;
IF (DIMIX(dimCust, sElem) = 0);
#While (DIMIX(dimCust, sElem) = 0);
sSeq = CELLGETN(CC, 'Customer_Seq', 'Value');
DIMENSIONELEMENTINSERTDIRECT ( dimCust , '', vVal, 'N');
DIMENSIONELEMENTCOMPONENTADD(DimCust, sForecastGroup, vVal, 1);
sSeq = sSeq + 1;
CELLPUTN(sSeq, CC, 'Customer_Seq', 'Value');
sNs_Id = 'ZZ_' | NUMBERTOSTRING(sSeq);
ATTRPUTS(sNS_ID, DimCust, vVal, 'NS_ID');
ENDIF;
this is what my METADATA tab has, originally i had all of
Code: Select all
CELLPUTN(sSeq, CC, 'Customer_Seq', 'Value');
sNs_Id = 'ZZ_' | NUMBERTOSTRING(sSeq);
ATTRPUTS(sNS_ID, DimCust, vVal, 'NS_ID');
when in data i got an error which was trying to populate all the elements with the same ID
when in metadata i got the error that any element after the first one i not foun in the dimension (even though when I checked it was being added)