Page 1 of 1

Store the Subset elements

Posted: Wed Aug 27, 2014 11:41 am
by krithika331
Hi,

I need to retrieve the Level 1 elements in a dimension and store in a variable. I want to create it using the subsetcreatebyMDX and not using the datasource. The elements retrieved had to be stored into a variable and use the vairable to update a dimension ( perform componentadd). I am new to Tm1 work. Any idea plz??

Re: Store the Subset elements

Posted: Wed Aug 27, 2014 12:08 pm
by tomok
Please read the request for assistance guidelines.

Re: Store the Subset elements

Posted: Wed Aug 27, 2014 12:13 pm
by BariAbdul
You have to use subsetcreatebyMDX and along the MDX statement on similar lines
{TM1FILTERBYLEVEL( {TM1SUBSETALL( [StoreLevel_CMO] )}, 0)} and that subset as variable vSubmdx=the subset created by you
Thanks.

Re: Store the Subset elements

Posted: Wed Aug 27, 2014 12:19 pm
by BariAbdul
I think it is bit more clear
SubsetCreatebyMDX('SubsetName', '{TM1FILTERBYLEVEL( {TM1SUBSETALL( [DimName] )}, 0,1)}' );
and assign this as variable.Thanks

Re: Store the Subset elements

Posted: Wed Aug 27, 2014 1:11 pm
by krithika331
Thanks for reply. I am doing the same as above. After I am assigning to the variable i am not getting error, but when I do the dimensionelementinsert , i am getting the invalid string expression. I have checked the syntax but it is showing correct.

Re: Store the Subset elements

Posted: Wed Aug 27, 2014 1:15 pm
by BariAbdul
Can you please post what you are trying.

Re: Store the Subset elements

Posted: Wed Aug 27, 2014 1:21 pm
by krithika331
Below is the simple code i am executing:

Prolog:

z =SubsetCreatebyMDX('sub1', '{TM1FILTERBYLEVEL( {TM1SUBSETALL( [Dim1] )}, 1)}' );

DimensionElementInsert ( 'Dim2', '', z, 'n' );

Re: Store the Subset elements

Posted: Wed Aug 27, 2014 1:44 pm
by lotsaram
krithika331 wrote:Below is the simple code i am executing:

Prolog:

z =SubsetCreatebyMDX('sub1', '{TM1FILTERBYLEVEL( {TM1SUBSETALL( [Dim1] )}, 1)}' );

DimensionElementInsert ( 'Dim2', '', z, 'n' );
Stop and think about what you are doing. Exercise your thinking skills no matter how much of a couch potato they might be.

You are assigning z the VALUE of the SubsetCreateByMDX function which will return a NUMERIC value indicating successful completion or failure.
You are then trying to insert the value of z into a dimension.
It should be obvious by now what you are doing wrong.
After creating Sub1 in Dim1 you need to setup a WHILE LOOP to process the MEMBER SET belonging to Sub1 and insert the members into Dim2.
If it is now not obvious then you might just be beyond help.