Page 1 of 1

Getting element names from the Attribute in TI

Posted: Mon Feb 21, 2011 7:11 am
by ExApplix
Hi,

This might be quite simple question - please take me as a newbie :)

As we know ATTRS returns the attribute value of an element. But is there a function which returns the name of the element if we pass the Attribute value to it.

Actually, my source data does not have the element names in it, but source data has got the Attribute values. Therefore I want to use my attribute values and load the data against the appropriate elements.

I was thinking of using DimensionElementPrincipalName() or SwapAliasWithPrincipalName(). But not sure if thats the right path.

Can someone please guide me?

Thanks :)

Re: Getting element names from the Attribute in TI

Posted: Mon Feb 21, 2011 8:07 am
by Alan Kirk
ExApplix wrote: This might be quite simple question - please take me as a newbie :)

As we know ATTRS returns the attribute value of an element. But is there a function which returns the name of the element if we pass the Attribute value to it.

Actually, my source data does not have the element names in it, but source data has got the Attribute values. Therefore I want to use my attribute values and load the data against the appropriate elements.

I was thinking of using DimensionElementPrincipalName() or SwapAliasWithPrincipalName(). But not sure if thats the right path.

Can someone please guide me?
DimensionElementPrincipalName is fine if the attribute is an alias, though you haven't said whether it is or not. This presupposes that you really do need the base element name, and can't do what you need to do with the alias name from the data source anyway.

If it's a standard string attribute, it doesn't have to be unique. Consequently it is possible that one attribute value could relate to multiple elements, which is why there's no function to return an element from a standard attribute.

On the other hand if the attribute does have a one-to-one relationship with the elements then it should be made into an alias.

Otherwise, all you can do is iterate through the dimension until you find the first element which has the attribute corresponding to the one that you're after. As I said, other than aliases, there is no way of getting an element name directly from an attribute value.