Page 1 of 1

Create Subsets in TI

Posted: Tue Jul 13, 2010 2:54 pm
by Beast
I have a product dimension is has many thousands of elements. To use the cascaded picklists functionality I have to of course create subsets.I can 'manually' create them using TI by adding

SubsetCreate('Products','ProductGroup1');
SubsetCreate('Products','ProductGroup2'); etc etc etc to the Prolog tab

and

SubsetElementInsert('Products',ProductType,Products,0); to the Metadata tab

This seems to work fine but ........

I have many hundreds of product groupsand so want to avoid manually amending the ti script text every time i hear of a new product group. Is there any way I can make the subset creation dynamic and with no manual intervention ?

Any thoughts ?

Cheers.

Re: Create Subsets in TI

Posted: Tue Jul 13, 2010 11:06 pm
by lotsaram
By using some attributes in your product dimension for product group and maybe also creating a separate product group dimension that is a summarised version of product dimension I don't see why this could not be entirely automated. You have all the tools you need.

Re: Create Subsets in TI

Posted: Wed Jul 14, 2010 1:35 pm
by Beast
Thanks lotsaram appreciated. Might have all the tools in my toolbag but I'm obviously trying to fix a broken pipe with a spade :D

Now I'm trying something along the lines of

SubsetCreate('Products',ATTRS('Product'',!Products,ProductGroup);

Am on the right lines ?

Re: Create Subsets in TI

Posted: Wed Jul 14, 2010 10:30 pm
by Martin Ryan
Not really, no :) Here's a quick step by step guide

1) Create an attribute called 'MySubset' in the dimension, say it's "CostCentre"
2) Populate some of the elements with a 1 against the 'MySubset' attribute
3) Create a TI process and set the source to be the "CostCentre" dimension you are working with
4) In the Parameters section of the Advanced tab create two parameters "pSubsetName" and "pAttrToUse"
5) In the Prolog tab write this code

Code: Select all

sDim='CostCentre';
if(subsetexists(sDim, pSubsetName)=1);
  SubsetDestroy(sDim, pSubsetName);
endif;
SubsetCreate(sDim, pSubsetName);
6) In the Data tab write this code

Code: Select all

if(attrn(sDim, elem, pAttrToUse)=1);
  SubsetElementInsert(sDim, pSubsetName, elem, 1);
endif;
# where elem is whatever variable name you gave in the variable tab of the TI process
That's all from memory, so you might need to check syntax, but it gives you the idea. You can then create attributes as you wish and add and remove elements using that attribute flag.

HTH,
Martin