i have created a drill process, and it works perfectly at 0 level when we drill from a cube. the problem i am having is that i want to be able to drill at any level of a dimension. i have used info i have found to create a subset using MDX in the prolog tab of the drill process. unfortunately, i do not have a vast knowledge on MDX, so this is all new to me.
Code: Select all
# variable for generated SQL
sSQL=' ';
# we need the children of this consolidated element in BusinessUnit dimension
sDimName = 'Business Unit';
sParentElemName=BusinessUnit;
# build subset in BusinessUnit dimension with all leaf children of the parent
sSubName='zTemp';
SubsetDestroy(sDimName,sSubName);
SubsetCreateByMdx(sSubName,'{TM1FILTERBYLEVEL( {TM1DRILLDOWNMEMBER( {['|sDimName|'].['|sParentElemName|']}, ALL, RECURSIVE )}, 0)}');
# iterate subset and add leaf elements to SQL statement
nCounter = 1;
nMaxCount= SubsetGetSize(sDimName,sSubName);
WHILE(nCounter<= nMaxCount);
sElemName= SubsetGetElementName(sDimName,sSubName,nCounter);
# make sure it is principal name to match values in source system
# probably don't need this line - the MDX should return this
sPrincipalElemName= DimensionElementPrincipalName(sDimName,sElemName);
# update SQL
sSQL= sSQL|CHAR(39)|sPrincipalElemName|CHAR(39);
# need a comma unless last item in subset
IF(nCounter<nMaxCount);
sSQL=sSQL|',';
ENDIF;
nCounter=nCounter+1;
END;
# clean up temp subset
SubsetDestroy(sDimName,sSubName);
# debug output
AsciiOutput('debug.txt',sSQL);
# assign to drill-through query
vBusinessUnit=sSQL;
what would the best MDX statement to use as there are multiple parents for some elements, as well as multiple levels?