Page 1 of 1

function to use for selecting element by attribute value

Posted: Wed Nov 03, 2010 7:34 pm
by vinnusea
How can i select an element in a dimension with its numeic attribute value??? in Turbo Integrator Please help

Re: function to use for selecting element by attribute value

Posted: Wed Nov 03, 2010 8:10 pm
by rkaif
I am not really sure what you are trying to do (as you have not explained it here).

But you can get the Attribute value of an element by using the ATTRS() function in the TI process

Re: function to use for selecting element by attribute value

Posted: Wed Nov 03, 2010 8:15 pm
by vinnusea
Hi
Yes i just need the element which matches the numeric attibute value..and i need to use this in Turbo integrator .
Any MDX or regular scripts /functions can help me???

Re: function to use for selecting element by attribute value

Posted: Wed Nov 03, 2010 8:22 pm
by rkaif
vinnusea wrote: Any MDX or regular scripts /functions can help me???
As mentioned earlier that ATTRS() function is the one which you need. Here is the syntax for it:

Code: Select all

ATTRS(dimension, element, attribute)
ATTRS('plan_business_unit', '10100', 'Currency')

Re: function to use for selecting element by attribute value

Posted: Wed Nov 03, 2010 8:27 pm
by vinnusea
So here the issue is
If i need a attribute value of period 01,2010 in period dimension
i would write as ATTRN(Period, !Period, Index Num) which give out some number example 117

But if i need something like this

Need Period Which matches the Index Num 117
then i must get 01-2010 out...

How can i get this???
Did i make my issue clear?

Re: function to use for selecting element by attribute value

Posted: Wed Nov 03, 2010 8:45 pm
by tomok
vinnusea wrote:So here the issue is
If i need a attribute value of period 01,2010 in period dimension
i would write as ATTRN(Period, !Period, Index Num) which give out some number example 117

But if i need something like this

Need Period Which matches the Index Num 117
then i must get 01-2010 out...

How can i get this???
Did i make my issue clear?
The index number attribute you are referring to would have to be not just an attribute, but also an alias and it can't be a numeric attribute, it would have to be string. You can store digits in the attribute, it just has to be set up as a string attribute to qualify to be an alias.

Re: function to use for selecting element by attribute value

Posted: Wed Nov 03, 2010 9:22 pm
by rkaif
vinnusea wrote:Need Period Which matches the Index Num 117
then i must get 01-2010 out...
Use DimensionElementPrincipalName() in a TI Process to get the Element name of the attribute.

Re: function to use for selecting element by attribute value

Posted: Wed Nov 03, 2010 9:34 pm
by Alan Kirk
rkaif wrote:
vinnusea wrote:Need Period Which matches the Index Num 117
then i must get 01-2010 out...
Use DimensionElementPrincipalName() in a TI Process to get the Element name of the attribute.
That only works with aliases. This has been stated to be a numeric attribute.

Vinnusea, two options are:
(a) Add the Index Number as an alias, as per Tomok's suggestion. This will only work if the index number attributes are unique; or
(b) Get the size of the dimension using DimSiz then search through it using DimNm until you find the one that you're looking for.

Option (a) would be the preferred one if you have a choice.

Re: function to use for selecting element by attribute value

Posted: Wed Nov 03, 2010 9:37 pm
by lotsaram
rkaif wrote:Use DimensionElementPrincipalName() in a TI Process to get the Element name of the attribute.
The OP is wanting to select elements by a numeric attribute value, this will not help.

vinnusea - you can do what you want and quite easily. Use SubsetCreateByMDX to create a filtered subset of your dimension based on the numeric attribute value you are seeking a match for. Do this on the prolog and then you can use this subset in the rest of your process. an alternative would be to simply process subset ALL for the dimension and do an initial test for the value and itemskip if you don't find a match.

Re: function to use for selecting element by attribute value

Posted: Wed Nov 03, 2010 11:16 pm
by vinnusea
yes this works... Really appreciate for your time guys..