SubsetCreateByMDX in TI

Post Reply
Willi
Regular Participant
Posts: 151
Joined: Mon Oct 07, 2013 11:51 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2010

SubsetCreateByMDX in TI

Post by Willi »

Hello,

I have a prolem with creating a subset by TI. I use the following Subset:
{TM1FILTERBYPATTERN( {TM1DRILLDOWNMEMBER( {[Produkt].[Alle Produkte]}, ALL, RECURSIVE )}, "*/ 0011 /*")}
wich is perfectly working on the Subset_Editor and Returns not an empty subset. But if I try to execute the TI I get the message that the subset could not be created! I've no idea where to look at.

Oh, almost forgot: I also tried the Version with single Quotation-marks entered by "CHAR(39)" in the formula. Same result and the MDX copied from the log to the subset-Editor gave me the wanted correct result!

Thanks in advance,
Willi
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: SubsetCreateByMDX in TI

Post by tomok »

Can't really help without the actual TI code......... :roll:
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Willi
Regular Participant
Posts: 151
Joined: Mon Oct 07, 2013 11:51 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2010

Re: SubsetCreateByMDX in TI

Post by Willi »

That's true. Sorry. I forgot to post the complete code.

This is in the Prolog-Tab:
vDimTmp = 'Produkt';
if (SubsetExists (vDimTmp, vSubTmp)=1, SubsetDestroy(vDimTmp, vSubTmp), 0);
And this is in the Data-Tab:
vAttrCognos = AttrS(vDim4,Produkt_MPL,'Cognos');
SubsetCreatebyMDX (vSubTmp, '{TM1FILTERBYPATTERN( {TM1DRILLDOWNMEMBER( {['|vDimTmp|'].[Alle Produkte]}, ALL, RECURSIVE )},
"*/ '|vAttrCognos|' /*")}');
The Variable "vAttrCognos" is correctly filled wich is proofed by the Error-Log.
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: SubsetCreateByMDX in TI

Post by tomok »

You need to move your SubsetCreateByMDX code to the Metadata tab.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Willi
Regular Participant
Posts: 151
Joined: Mon Oct 07, 2013 11:51 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2010

Re: SubsetCreateByMDX in TI

Post by Willi »

There it was before. Same result.
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: SubsetCreateByMDX in TI

Post by declanr »

Use:

Code: Select all

SubsetCreatebyMDX (vSubTmp, '{TM1FILTERBYPATTERN( {TM1DRILLDOWNMEMBER( {['|vDimTmp|'].[Alle Produkte]}, ALL, RECURSIVE )},
"*/ '|vAttrCognos|' /*")}', vDimTmp);
To find out whether the MDX statement really does return any elements.
Declan Rodger
User avatar
Michel Zijlema
Site Admin
Posts: 713
Joined: Wed May 14, 2008 5:22 am
OLAP Product: TM1, PALO
Version: both 2.5 and higher
Excel Version: 2003-2007-2010
Location: Netherlands
Contact:

Re: SubsetCreateByMDX in TI

Post by Michel Zijlema »

SubsetCreateByMDX is a function that typically should not be used on either the MetaData or Data tab, which are executed per record/cell in the datasource.
So I would move the statement to either the Prolog or Epilog (if dependent on metadata changes) tab.

Michel

(Of course, if you really need to create multiple subsets, one per record/cell in the datasource, then the data tab should be OK (the vSubTmp variable should then be changing per record/cell too). In my statement above I was assuming this is not the case.)
Willi
Regular Participant
Posts: 151
Joined: Mon Oct 07, 2013 11:51 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2010

Re: SubsetCreateByMDX in TI

Post by Willi »

Michel:

Thx, but I Need this Statement for every cell returned by the Datasource. So I Need to put it in the Metadata or Data Tab. The process is not run interactively by the user. So time is not the highest priority.

The subset is deleted after it's used in the TI.

declan:

Thx. This is not the soution but pointed me to my (!!!) error. I tested the MDX in the Subset-Editor with an Alias activated. This changes the filter dramatically. I now have to find the solution how to use the alias in aa MDX or Change the filter to use the Original Element-Names.

Thx to all.
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: SubsetCreateByMDX in TI

Post by Wim Gielis »

Willi wrote:I now have to find the solution how to use the alias in aa MDX or Change the filter to use the Original Element-Names.
The function SubsetAliasSet maybe?
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
Willi
Regular Participant
Posts: 151
Joined: Mon Oct 07, 2013 11:51 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2010

Re: SubsetCreateByMDX in TI

Post by Willi »

Hm, but if I understand the documentation correctly I have to specify an already existing subset for this function. I want to create a new one.
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: SubsetCreateByMDX in TI

Post by declanr »

Use the 3 parameter SubsetCreateByMDX function I put above so it creates your mdx subset although it will be empty. Then use subsetaliasset on that.
Declan Rodger
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: SubsetCreateByMDX in TI

Post by rmackenzie »

Willi wrote:Hm, but if I understand the documentation correctly I have to specify an already existing subset for this function. I want to create a new one.
Then just create the 'Alle Produkte' drilldown subset in the Prolog and refer to it in the Data tab, e.g.:

Code: Select all

# Prolog
# create 'base' subset
SubsetCreatebyMDX ( 'base_subset', ' {TM1DRILLDOWNMEMBER( {[Produkt].[Alle Produkte]}, ALL, RECURSIVE )}' );
# apply alias
SubsetAliasSet ( 'Produkt', 'base_subset', AttrS(vDim4,Produkt_MPL,'Cognos') );

# Data
vSubTmp = 'SOME NEW SUBSET NAME';
SubsetCreatebyMDX (vSubTmp, '{TM1FILTERBYPATTERN( {[Produkt].[base_subset]}, "*/ '|vAttrCognos|' /*")}');
Try it and see?
Robin Mackenzie
Willi
Regular Participant
Posts: 151
Joined: Mon Oct 07, 2013 11:51 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2010

Re: SubsetCreateByMDX in TI

Post by Willi »

Thx for all you effort. It works!
Post Reply