Page 1 of 1

TM1 Process create element and add Data

Posted: Wed Jun 15, 2011 6:21 am
by dermanaus
Hi hope someone can help.

We are trying to load Capex Items to a Cube from a CSV File.
Each Capex Item creates it own element based on the value of the Last Element IE Consolidation Cost Centre 1310 , Element 1310 - 00001

We can successfully create all of the Elements correctly in the MetaData however when we come to add data to the Cube we have an issue as we dont know the number of records to loop through and
the element to add the data to within the Cube.

We have used a numbering system within the CSV files however this is difficult to maintain when multiple files are being uploaded.

Thank you...

Re: TM1 Process create element and add Data

Posted: Wed Jun 15, 2011 2:07 pm
by ajain86
Firstly, I would suggest splitting up this into 2 processes. Although, you can add elements and then subsequently load data to it in the same process, I have found that it is best to split this task into 2.

Do you have any alias on your elements? Or is this there any unique identifier that you can add to each element (current and any you add) that would also be present in the load file? This would ease the task of loading in the data.

Re: TM1 Process create element and add Data

Posted: Wed Jun 15, 2011 9:28 pm
by Martin Ryan
A couple of ideas for keeping track of your counter.

One: in the prolog have counter=0; in the data tab have counter=counter+1; then you can keep track of how many records you have processed. As a variation you can increment the counter only when you actually write something.

Two: loop through a list in the data tab
i=0;
while(i<1000);
i=i+1;
if(cellgetn('cube', dim1, dim2, i)=0);
cellputn(value, 'cube', dim1, dim2, i);
i=10001; # to ensure we exit the while loop
else;
# Do nothing, skip on to next i
endif;
end;

Hopefully that should help you along.

Martin