Page 1 of 1

Identify Children Whose Parent having Attr Value 1

Posted: Mon Mar 21, 2011 9:36 pm
by vinnusea
Hi
I am trying to apply some calculations for children Only when its Parent have the Attribute value =1

Ex: (((Dimension:Model,Attribute :Numericpull)))
Image
Here If "2" is having Attribute value 1 then Its children at least level (pra,pra2,pra3,pra4,1,3,4) Must be Multiplied by number 24

Can any one help me out please!!!
-Thank you

Re: Identify Children Whose Parent having Attr Value 1

Posted: Mon Mar 21, 2011 11:41 pm
by paulsimon
Hi

I am guessing that the key aspect of this problem is that you don't know how many levels up the flag might be set, so you can't just use a simple elpar. Therefore you need some recursion to cascade the flag down.

Here is an example in the model dimension of the planning sample. The rule is written in the }ElementAttributes cube. I added two text (String) attributes, one called Flag and one called CascadedFlag

Code: Select all

skipcheck ;

['Total','CascadedFlag']=S: attrs('model',!model,'Flag')  ;

['CascadedFlag']=S:
  IF( attrs('model',!model,'Flag') @= '1' 
        ,
        attrs('model',!model,'Flag')
        ,
       DB('}ElementAttributes_model',elpar('model',!model,1),'CascadedFlag')
  ) ;
The planning sample isn't a great example since the hierarchy doesn't join up properly but if you look at Total and the T Series or just adapt this to your example it should work OK.

Once you have cascaded the '1' down from the upper level to the base level then you can just write a rule like this in your main cube:

Code: Select all

['Result'] = N:
  IF( attrs('model', !model, 'CascadedFlag') @= 1
       ,
       ['Value'] * 24
       ,
       ['Value']
  ) ;


Regards

Paul Simon

Re: Identify Children Whose Parent having Attr Value 1

Posted: Tue Mar 22, 2011 2:06 pm
by vinnusea
That One is Awesome... I am able to Achieve my Goal.
Thank you soo much ,,,