Page 1 of 1

build new dimension using subset of a dimension using TI pro

Posted: Tue Jul 06, 2010 12:16 pm
by sunitha
Hi,

I'm building the dimension,using existing dimension model,where the existing dimension has the different costcentres for ex.hr,IT,Fin under each costcentre we have different levels.i want to build the different individual dimensions like HR,FIN,IT dimensions using existing dimension model as input in TI Process.

i'm trying to acheive this by creating a subset with level0 elements and try to build the different dimensions by using the ELPAR functions in metadata tab.But i'm not able to build the dimension with complete hierarchy.

It is on high priority to build the dimension.

can any on please guide/help me how to build this..

Thanks in advance for your assistance.

regards,
Sunitha.

building new dimension using subse of dim in TI processes

Posted: Tue Jul 06, 2010 12:19 pm
by sunitha
Hi,

I'm building the dimension,using existing dimension model,where the existing dimension has the different costcentres for ex.hr,IT,Fin under each costcentre we have different levels.i want to build the different individual dimensions using the existing dimension modelm as input.

i tried using subset and elpar functions but i'm not able to build it.

can you please guide me how to build this..

Thanks in advance for your assistance..

regards,
Sunitha.

{Admin Note: This topic has been merged into an almost identical one by the same poster. Please keep one topic to one thread. Thanks.}

Re: build new dimension using subset of a dimension using TI

Posted: Tue Jul 06, 2010 12:43 pm
by Wim Gielis
Hello,

What is the logic to choose the elements HR, FIN, IT, ...

- do they contain an attribute?
- is it always level 4 or 3 or any other number (but always the same)?
- or these the direct children of some other consolidation?
- are these all elements in the dimension with parents?
- ...

Without a clear definition of these items, you're process will not work.

Wim

Re: build new dimension using subset of a dimension using TI

Posted: Tue Jul 06, 2010 1:08 pm
by sunitha
Hi Wim,

there are no attributes in the base dimension.
we have level 4 hirearchy in the base dimension
each department in the dimension has its direct children with level3 hierarchy.

for reference i'm attaching snap shot of the base dim with different depts.what we need to do was, we need to build individual dimensions like hr,fin etc with the help os base dim

regards,
sunitha

Re: build new dimension using subset of a dimension using TI

Posted: Tue Jul 06, 2010 1:51 pm
by sunitha
attached doc is the sample base dimension which has three departments HR, Fin, Trans.It has its own children, without any attributes. Now the requirement is we need to build the individual dimensions like HR, FIN, Trans as different dimensions by using the base dimension with TI processes.

Can any one help me how to build this?

Re: build new dimension using subset of a dimension using TI

Posted: Tue Jul 06, 2010 9:37 pm
by Wim Gielis
Hello

Here's fully developed TI code. Copy paste the code into the Advanced > Prolog tab of a TI process, use 'None' as the Data source.

Code: Select all

# Wim Gielis
# http://www.wimgielis.be


# create the dimension
i=1;

WHILE(i<=ELCOMPN('ecc_planningprocess','totalunits'));

     vComp=ELCOMP('ecc_planningprocess','totalunits',i);

     IF(DIMENSIONEXISTS(vComp)=1);
          DIMENSIONDELETEALLELEMENTS(vComp);
     ELSE;
          DIMENSIONCREATE(vComp);
     ENDIF;

     SUBSETDESTROY('ecc_planningprocess','mysubset');
     SUBSETCREATEBYMDX('mysubset', ' {TM1FILTERBYLEVEL({DESCENDANTS(ecc_planningprocess.[' | vComp | ']) }, 0)}' );

     # loop through the elements of the subset

      j=1;

     WHILE(j<=SUBSETGETSIZE('ecc_planningprocess','mysubset'));

          vElem=SUBSETGETELEMENTNAME('ecc_planningprocess','mysubset',j);
          vType=DTYPE('ecc_planningprocess',vElem);

          DIMENSIONELEMENTINSERT(vComp,'',vElem,vType);

          # PARENTS (loop through them)
          k=1;
          WHILE(k<=ELPARN('ecc_planningprocess',vElem));
               vParent=ELPAR('ecc_planningprocess',vElem,k);

               IF(vParent@<>vComp);
                    vWeight=ELWEIGHT('ecc_planningprocess',vParent,vElem);
                    DIMENSIONELEMENTINSERT(vComp,'',vParent,'C');
                    DIMENSIONELEMENTCOMPONENTADD(vComp,vParent,vElem,vWeight);
                     k=k+1;
                ENDIF;
          END;

          j=j+1;

     END;

     i=i+1;

END;

SUBSETDESTROY('ecc_planningprocess','mysubset');
That should do it.

Use variables to reduce the amount of hardcoded names.

Wim

Re: build new dimension using subset of a dimension using TI

Posted: Thu Jul 08, 2010 11:55 am
by sunitha
Thank you wim
for your interest it helped me in creating the dimensions.

Re: build new dimension using subset of a dimension using TI

Posted: Wed Sep 08, 2010 3:22 pm
by sivan307
Thanks Wim. I am able to use your code to do a similar task today. Thanks for the code. Thanks Sunitha :-)

Re: build new dimension using subset of a dimension using TI

Posted: Tue Apr 09, 2013 7:52 am
by Armonds
Great example, it helped me a lot.

Re: build new dimension using subset of a dimension using TI

Posted: Thu Mar 27, 2014 3:52 am
by BariAbdul
Hi All,I have created dimension 'ecc_planningprocess' and tried below Wim Gielis code:

Code: Select all

    # Wim Gielis
    # http://www.wimgielis.be


    # create the dimension
    i=1;

    WHILE(i<=ELCOMPN('ecc_planningprocess','totalunits'));

         vComp=ELCOMP('ecc_planningprocess','totalunits',i);

         IF(DIMENSIONEXISTS(vComp)=1);
              DIMENSIONDELETEALLELEMENTS(vComp);
         ELSE;
              DIMENSIONCREATE(vComp);
         ENDIF;

         SUBSETDESTROY('ecc_planningprocess','mysubset');
         SUBSETCREATEBYMDX('mysubset', ' {TM1FILTERBYLEVEL({DESCENDANTS(ecc_planningprocess.[' | vComp | ']) }, 0)}' );

         # loop through the elements of the subset

          j=1;

         WHILE(j<=SUBSETGETSIZE('ecc_planningprocess','mysubset'));

              vElem=SUBSETGETELEMENTNAME('ecc_planningprocess','mysubset',j);
              vType=DTYPE('ecc_planningprocess',vElem);

              DIMENSIONELEMENTINSERT(vComp,'',vElem,vType);

              # PARENTS (loop through them)
              k=1;
              WHILE(k<=ELPARN('ecc_planningprocess',vElem));
                   vParent=ELPAR('ecc_planningprocess',vElem,k);

                   IF(vParent@<>vComp);
                        vWeight=ELWEIGHT('ecc_planningprocess',vParent,vElem);
                        DIMENSIONELEMENTINSERT(vComp,'',vParent,'C');
                        DIMENSIONELEMENTCOMPONENTADD(vComp,vParent,vElem,vWeight);
                         k=k+1;
                    ENDIF;
              END;

              j=j+1;

         END;

         i=i+1;

    END;

    SUBSETDESTROY('ecc_planningprocess','mysubset');
But when I run the process in TM1 perspectives,It doesn't show any error but the process doesn't initialize and keep running on and hangs up.Any ideas please.Thanks

Re: build new dimension using subset of a dimension using TI

Posted: Sat Aug 02, 2014 4:29 pm
by BariAbdul
Hi Wim,I have tried again ,It is giving me error dimension ecc_planningprocess could not be find ,when I commented out

Code: Select all

SUBSETDESTROY('ecc_planningprocess','mysubset');
the process runs successfully but I do not see any 'ecc_planningprocess' dimension being created.Please help me on this.Thanks

Re: build new dimension using subset of a dimension using TI

Posted: Sat Aug 02, 2014 4:46 pm
by declanr
BariAbdul,

Please post the entire contents of your TI.

Re: build new dimension using subset of a dimension using TI

Posted: Sat Aug 02, 2014 5:05 pm
by BariAbdul
Thanks a lot declanr,The entire Code is below, as Wim suggested I have choose none as the data source and pasted whole content below

Code: Select all

# Wim Gielis
# http://www.wimgielis.be


# create the dimension
i=1;

WHILE(i<=ELCOMPN('ecc_planningprocess','totalunits'));

     vComp=ELCOMP('ecc_planningprocess','totalunits',i);

     IF(DIMENSIONEXISTS(vComp)=1);
          DIMENSIONDELETEALLELEMENTS(vComp);
     ELSE;
          DIMENSIONCREATE(vComp);
     ENDIF;

     SUBSETDESTROY('ecc_planningprocess','mysubset');
     SUBSETCREATEBYMDX('mysubset', ' {TM1FILTERBYLEVEL({DESCENDANTS(ecc_planningprocess.[' | vComp | ']) }, 0)}' );

     # loop through the elements of the subset

      j=1;

     WHILE(j<=SUBSETGETSIZE('ecc_planningprocess','mysubset'));

          vElem=SUBSETGETELEMENTNAME('ecc_planningprocess','mysubset',j);
          vType=DTYPE('ecc_planningprocess',vElem);

          DIMENSIONELEMENTINSERT(vComp,'',vElem,vType);

          # PARENTS (loop through them)
          k=1;
          WHILE(k<=ELPARN('ecc_planningprocess',vElem));
               vParent=ELPAR('ecc_planningprocess',vElem,k);

               IF(vParent@<>vComp);
                    vWeight=ELWEIGHT('ecc_planningprocess',vParent,vElem);
                    DIMENSIONELEMENTINSERT(vComp,'',vParent,'C');
                    DIMENSIONELEMENTCOMPONENTADD(vComp,vParent,vElem,vWeight);
                     k=k+1;
                ENDIF;
          END;

          j=j+1;

     END;

     i=i+1;

END;

SUBSETDESTROY('ecc_planningprocess','mysubset');

Re: build new dimension using subset of a dimension using TI

Posted: Sat Aug 02, 2014 5:18 pm
by declanr
You say that you see no "ecc_planningprocess" dimension being created but the first thing your TI tries to do is read what is already in that dimension. If it doesn't exist when you start it won't do a great deal.

Perhaps I am missing something but lets go back to basics, what are you trying to do? What already exists and what are you trying to create from it?

Re: build new dimension using subset of a dimension using TI

Posted: Mon Aug 04, 2014 7:38 am
by BariAbdul
Thanks a lot Declanr,Actually I am trying to create dimension similar to OP sunitha has posted.When I find 'No Dimension Found Error',I did create empty dimension using DimensionCreate(ecc_planningprocess) but nothing being created.Now I would create dimension similar to attachement the OP posted and see whether it would worked out.Appreciate your help.

Re: build new dimension using subset of a dimension using TI

Posted: Mon Aug 04, 2014 7:49 am
by declanr
The code you are using has its first step of looping an elements children... if that element doesn't exist nothing in the loop will be done.