Page 1 of 1

Create Year-Quarter-Month Hierarchy

Posted: Thu Feb 09, 2012 11:51 pm
by slu
I found a TI process in our system that creates our time dimension, but it rolls all months to year, rather than rolls Jan-mar to Q1 which is our existing structure. I tried to modify it based on my understanding of the code, I have difficulty to understand why Jan-Mar was rolled to both Q1-Q2 and Year though I already defined in where components should be added to strquarter1-2, which is 2015Q1 &2015Q2. I also tried to import cvs file (we have a TI code to export dimension to cvs file), I just do find/replace to 2015, save it. I attach screen prints of the process. Error message indicated that "can not open the cvs. file", weird, I saw data in preview.

I need your helps to resolve both TI process and traditional way of importing data via text data source. All replies I got from this forum are great. As a new TM1 members, thanks again for your time.

Code: Select all

# create year>4quarters>month tree to bpmTime



#****Begin: Generated Statements***
#****End: Generated Statements****

strDim = 'bpmTime';


#===================================
# >>> Create Roots (if needed)
#===================================

strRoot1 = 'Years';
strRoot2 = 'YTD';
strRoot3 = 'QTD';

numCtr = 1;
numCtrMax = 3;

WHILE (numCtr <= numCtrMax);
     strVal = NUMBERTOSTRING (numCtr);
     strElem = EXPAND ('%' | 'strRoot' | strVal | '%');


     IF (DIMIX (strDim, strElem) = 0);
          DIMENSIONELEMENTINSERT (strDim, '', strElem, 'C');
     ENDIF;

     numCtr = numCtr + 1;
END;



#===================================
# >>> Create Parents
#===================================

strElem = parYear;

IF (DIMIX (strDim, strElem) = 0);
     DIMENSIONELEMENTINSERT (strDim, '', strElem, 'C');
ENDIF;

DIMENSIONELEMENTCOMPONENTADD (strDim, strRoot1, strElem, 1);


#Create Q1-Q4 Consolidation

          strquarter1 = parYear | 'Q1';
	  strquarter2 = parYear | 'Q2';
	  strquarter3 = parYear | 'Q3';
	  strquarter4 = parYear | 'Q4';

numCtr = 1;
numCtrMax = 4;

WHILE (numCtr <= numCtrMax);
     strVal = NUMBERTOSTRING (numCtr);
     strElem = EXPAND ('%' | 'strquarter' | strVal | '%');


#Create Parents
     IF (DIMIX (strDim, strElem) = 0);
          DIMENSIONELEMENTINSERT (strDim, '', strElem, 'C');
     ENDIF;

strParent = parYear;
DIMENSIONELEMENTCOMPONENTADD (strDim, strParent, strElem, 1);


     numCtr = numCtr + 1;
END;

#===================================
# >>> Create Base Level Elements
#===================================

str0 = 'Opening Balance ' | parYear;
str1 = 'Jan-' | parYear;
str2 = 'Feb-' | parYear;
str3 = 'Mar-' | parYear;



DIMENSIONELEMENTCOMPONENTADD (strDim, strquarter1, str0,1);
DIMENSIONELEMENTCOMPONENTADD (strDim, strquarter1, str1,1);
DIMENSIONELEMENTCOMPONENTADD (strDim, strquarter1, str2,1);
DIMENSIONELEMENTCOMPONENTADD (strDim, strquarter1, str3,1);


str4 = 'Apr-' | parYear;
str5 = 'May-' | parYear;
str6 = 'Jun-' | parYear;

DIMENSIONELEMENTCOMPONENTADD (strDim, strquarter2, str4,1);
DIMENSIONELEMENTCOMPONENTADD (strDim, strquarter2, str5,1);
DIMENSIONELEMENTCOMPONENTADD (strDim, strquarter2, str6,1);

Re: Create Year-Quarter-Month Hierarchy

Posted: Fri Feb 10, 2012 12:24 am
by tomok
Why anyone would spend the time to create this type hierarchy via a TI process is beyond me. It's not like you would ever need to rebuild this on a regular basis. This is something that only needs maintenance once a year. Just do it with an XDI sheet, it will be much easier.

P.S. Don't ask me what an XDI sheet is. If you don't know, read the Users Guide.

Re: Create Year-Quarter-Month Hierarchy

Posted: Fri Feb 10, 2012 8:12 am
by lotsaram
I'm with Tomok on this. Why anyone would want to write code to build what is in effect a quite small, quite simple and quite static dimension is beyond me. This can be done on minutes with the dimension editor (and considerably quicker in an XDI).

I do know of instances where on projects I have worked on where this type of code has been written. Once I would say it was for a "good reason" to create a standard application for any TM1 server where all that was needed for the installation was to drop in a few TI processes which then "unpacked" or created all the required objects. The other time was for what I would regard as a "bad reason" where due project management and compliance practices in place developers had no access to prod due to separation of duties and the "admins" with access to production were numpties who couldn't be trusted to get something as complicated as the admittedly don-existant TM1 dev-test-prod transportation right so in order not to stuff things up everything had to be made as simple as possible by creating "change packages in TI" where all object creation or modification was done via TI and unit tested then all that was needed to promote to prod was a drop and run operation by copying just the TIs to prod.

Those caveats aside my feeling on the matter in general still stands. And I don't think either of those situations applies in this case.
tomok wrote:Why anyone would spend the time to create this type hierarchy via a TI process is beyond me. It's not like you would ever need to rebuild this on a regular basis. This is something that only needs maintenance once a year. Just do it with an XDI sheet, it will be much easier.
My guess:
1/ not everyone is blessed with the same degree of common sense as you or I might be
2/ some consultancies interpretation of business ethics are less rigid presumably than yours or mine and people are happy to burn hours on non-value-adding activities

Re: Create Year-Quarter-Month Hierarchy

Posted: Fri Feb 10, 2012 11:27 am
by Edward Stuart
Error message indicated that "can not open the cvs. file", weird, I saw data in preview.
Do you still have the .csv file open when attempting to run the process?
I need your helps to resolve both TI process and traditional way of importing data via text data source.
As tomok suggests have a look at the User guide for XDI but also check the Bedrock TM1 Dimension ImportfromFile if you still want to use the export/ import method.

Re: Create Year-Quarter-Month Hierarchy

Posted: Fri Feb 10, 2012 2:47 pm
by slu
I understand both experts' comment, dimension update is nonrecurring. I tried to explain to a power user in the company (I am new to the company) that I can execute the TI to get most done (we have YTD and QTD in TI code too), then just add four quarters, then assign months to it. He insisted that it is better to run a TI to get all done. For me, I review all the TI processes to understand what they do (we just upgrade from 9.4 to 9.5, need testing any errors), for due diligence (plan to add new years to dimension, checking any TI processes or rules that would break), for learning TI coding and for learning different ways of maintaining cubes, dimensions.

I surfed bedrock.org, to review TI codes there for learning purpose, seems like I need to download it to view all codes. But I do not want to mix bedrock TI processes with my company's. Please help how to use those open source codes when you use the site, hints would help. Is it possible I install TM1 to my home computer? then I download bedrock TI to my home computer.

No I did not open the cvs file when I did the process. Must the cvs file place in the data directory of TM1dev? I save cvs file in my personal network folder.

I will take the suggestion reviewing 4-5 guides multiple times to avoid asking naive questions. Thanks

Re: Create Year-Quarter-Month Hierarchy

Posted: Fri Feb 10, 2012 2:54 pm
by Steve Rowe
Hi slu,

So to try and answer your questions.

The reason why your months may be in both year and quarter is that there is nothing in the TI to remove the months from their direct consolidations into Year. So if the months were already rolling into year before you run the TI they still will be when you run the TI process, unless you write code to remove them.

For your TI process being able to read your cvs file despite being able to see it in the preview pane, don't forget the path to the file will be different for the client and the server. The client path is what is used when you open the TI up in the SE, when the TI runs the server path is used, if this is not correct you'll get the error generated.

Hopefully that's a bit more constructive than just posting to abuse the approach. The approach I think is pretty reasonable when you consider that the majority of TM1 sites run with very limited or no TM1 resource to look after them and having a TI to extend your period dimension each year is very useful.

Cheers,