Page 1 of 1
SubsetGetElementName when alias is selected
Posted: Fri Aug 30, 2013 7:49 pm
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
Re: SubsetGetElementName when alias is selected
Posted: Fri Aug 30, 2013 9:04 pm
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.
Re: SubsetGetElementName when alias is selected
Posted: Fri Aug 30, 2013 10:20 pm
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.
Re: SubsetGetElementName when alias is selected
Posted: Fri Aug 30, 2013 10:47 pm
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.
Re: SubsetGetElementName when alias is selected
Posted: Fri Aug 30, 2013 11:06 pm
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.
Re: SubsetGetElementName when alias is selected
Posted: Mon Sep 02, 2013 11:55 am
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...
Re: SubsetGetElementName when alias is selected
Posted: Mon Sep 02, 2013 2:27 pm
by lotsaram
rmackenzie wrote:Nice article here if it becomes an option for you in the future...
"Like"
Re: SubsetGetElementName when alias is selected
Posted: Wed Sep 04, 2013 8:37 pm
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.
Re: SubsetGetElementName when alias is selected
Posted: Wed Sep 04, 2013 9:15 pm
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...
