SubsetGetElementName when alias is selected

Post Reply
Wim Gielis
MVP
Posts: 3241
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

SubsetGetElementName when alias is selected

Post by Wim Gielis »

Hello all

I wonder if this is a bug, or if it has always been like that (then, why ?)

If you have a subset whereby an alias is turned on, and you do:

Code: Select all

AsciiOutput('test.txt', SubsetGetelementName('FIN_Accounts', 'Description', 1));
you get (at least, I get) the correct element but the element's principal name is shown.

Can anyone verify this please? TM1 10.1.1

Thanks.

Wim
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: SubsetGetElementName when alias is selected

Post by tomok »

This is how it's always worked to the best of my knowledge. After all it is SubsetGetElementName isn't it. It's not SubsetGetElementAlias. Just stick an ATTRS function in there and you're good to go.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Wim Gielis
MVP
Posts: 3241
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: SubsetGetElementName when alias is selected

Post by Wim Gielis »

Thank you for your reply, Tomok.

I'd be happy to stick an ATTRS function in there, only that, what if I don't know what alias was set?
We have no way to loop through the chosen subset elements unless we know what alias was chosen. (Inspecting the .sub file is not an option)
I agree that it's rather rare as a situation, but it is not impossible either.

The function returns the name of the element; a DimensionElementPrincipalName can do that too, if the function returned the subset element in the chosen alias.
But not the other way round.
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
declanr
MVP
Posts: 1831
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: SubsetGetElementName when alias is selected

Post by declanr »

Wim Gielis wrote: I'd be happy to stick an ATTRS function in there, only that, what if I don't know what alias was set?
We have no way to loop through the chosen subset elements unless we know what alias was chosen. (Inspecting the .sub file is not an option)
I agree that it's rather rare as a situation, but it is not impossible either.
I agree it's a bit of an annoying one but since it's always been this way I try to always do the following:

Create a 2-d cube "}a_dimension_properties" consisting of:
  • }Dimensions (system gen'd or often use my own version which I replicate from the system generated dim via chore scheduled every night for various purposes)
  • }a_dimension_properties_measures
n.b the "a" at the start is just so that it appears at the beginning to differentiate the } prefixed items I create vs the system ones.


Every time I create a new public subset I add it into my "}a_dimension_properties_measures" dim as "subset_<subset name>_alias" (string of course.)

Then at intersection I type in the alias that I saved the public subset down as using.


This can be retrieved for such purposes as the one you described here and I also tend to hold a lot of other information in the cube as opposed to just subset aliases, if you have a standard subset name for a number of dimensions (like "All (leaf)") then that's not a problem due to the cube structure.

It's obviously a little bit of extra work to maintain but once you get into the habit of doing it (and convince all other admins to do the same) it's only really a small extra step to creating your subset anyway.
Declan Rodger
Wim Gielis
MVP
Posts: 3241
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: SubsetGetElementName when alias is selected

Post by Wim Gielis »

Good idea Rodger, though I find it a little bit overkill ;-)
(extra cubes, nightly chore, and the like)
Nevertheless the info in the cube can be useful at times.
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: SubsetGetElementName when alias is selected

Post by rmackenzie »

Wim Gielis wrote:(Inspecting the .sub file is not an option)
Nice article here if it becomes an option for you in the future...
Robin Mackenzie
lotsaram
MVP
Posts: 3706
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: SubsetGetElementName when alias is selected

Post by lotsaram »

rmackenzie wrote:Nice article here if it becomes an option for you in the future...
"Like"
Wim Gielis
MVP
Posts: 3241
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: SubsetGetElementName when alias is selected

Post by Wim Gielis »

I like that one too.

Now speaking of subsets, here's almost a oneliner to get all private and public subsets into Excel, column A:

Code: Select all

Sub test()
    
    sPath = "C:\Wim\TM1"
    varSubsets = Filter(Split(CreateObject("wscript.shell").exec("cmd /c Dir """ & sPath & "\*.sub"" /b /a-d /s").stdout.readall, vbCrLf), ".")
    Cells(1).Resize(UBound(varSubsets)) = Application.Transpose(varSubsets)

End Sub
sPath is the path towards the data directory.

Just playing around :-)

And posting it here so that chances increase that I will find it back should I need it in the future.
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Alan Kirk
Site Admin
Posts: 6667
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: SubsetGetElementName when alias is selected

Post by Alan Kirk »

Wim Gielis wrote: Now speaking of subsets, here's almost a oneliner to get all private and public subsets into Excel, column A:
That's one choice little line of code there.
Wim Gielis wrote:And posting it here so that chances increase that I will find it back should I need it in the future.
Yes, I've done that with a couple of things too. The "recommended order of dimensions" for one is always way easier for me to find through the FAQ than to remember which manual it's in. (Especially as the FAQ link contains alternative opinions.) Same thing with the command line to create a service; I just go copy the code out of my article. The Forum's kinda useful that way... :D
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
Post Reply