Page 1 of 1

Hierarchy as a Datasource

Posted: Tue Sep 11, 2018 10:20 pm
by PavoGa
Quick question: can a dimension hierarchy be used as a datasource?

Tried it by creating a hierarchy subset and then the following:

Code: Select all

sMDX = 'TM1FILTERBYLEVEL(TM1SUBSETALL( [Accounts Master].[Statistical Categories]), 0)';

HierarchySubsetCreate(dimAccountsMaster, hierStatisticalCategories, subStatisticalCategories, 1);
HierarchySubsetMDXSet(dimAccountsMaster, hierStatisticalCategories, subStatisticalCategories, sMDX);

DataSourceType = 'SUBSET';
# this does not work either: DataSourceNameForServer = dimAccountsMaster;
DataSourceNameForServer = hierStatisticalCategories;
DataSourceDimensionSubset = subStatisticalCategories;
If I am not missing something here in setting up the datasource and hierarchies cannot be used directly as a datasource, then the only choice is to create a temporary dimension with the elements in the hierarchy subset?

Hope I'm just missing something because I'm just diving into using the hierarchy functionality.

Re: Hierarchy as a Datasource

Posted: Wed Sep 12, 2018 4:47 am
by lotsaram
It works just fine. The trick is to set the hierarchy as the dimension source with DatasourceNameForServer variable with the hierarchy's "full name" as it appears in }Dimensions. You can't use just the hierarchy name and have to concatenate the dimension name with colon as hierarchy names aren't unique (e.g. "Leaves").

E.g.
DatasourceNameForServer = ‘dim:hier’;

Or as per your code above it would be
DataSourceNameForServer = dimAccountsMaster |':'| hierStatisticalCategories;
DataSourceDimensionSubset = subStatisticalCategories;

Re: Hierarchy as a Datasource

Posted: Wed Sep 12, 2018 12:22 pm
by PavoGa
Thank you, Lotsaram. That took care of it.

:oops: I should have tried that. I'd seen the syntax for that in other places and just did not connect the dots on it.