Page 1 of 1
Remove Element from a Subset
Posted: Tue Oct 09, 2012 8:49 pm
by jim wood
Guys,
Is there a way to remove a specific element from within a subset. I found a command to remove an element depending on it's index but I haven't found a command to find the elements position within the subset to pass to the SubsetElementDelete command. Has anybody found a quick and easy way to find an elements subset position?
Thanks,
Jim.
PS. I am avoiding using MDX by the way as using a dynamic subset slows down the extract we are trying to create.
Re: Remove Element from a Subset
Posted: Tue Oct 09, 2012 8:56 pm
by Alan Kirk
jim wood wrote:
Is there a way to remove a specific element from within a subset. I found a command to remove an element depending on it's index but I haven't found a command to find the elements position within the subset to pass to the SubsetElementDelete command. Has anybody found a quick and easy way to find an elements subset position?
You would be referring to the SubIx function... which as Martin in particular has pointed out many times over the years to deaf ears in the IBM development teams, does not exist and is a glaring omission from the toolset. Given that it's not something that would be featured in a glossy sales presentation and does not involve the creation of new icons, I wouldn't count on seeing it any time soon.
AFAIK the only way is to iterate through the subset until you find the element concerned.
Re: Remove Element from a Subset
Posted: Tue Oct 09, 2012 9:03 pm
by jim wood
After posting I found another post along similar lines with a link to some process code for doing just that. Not having SubIx isn't something that I have had a problem with until now, but hey ho. As you said in your original reply to the other post I may need to add exception functionality to the generic process I created,
Jim.
Re: Remove Element from a Subset
Posted: Tue Oct 09, 2012 10:05 pm
by Duncan P
While we're on the subject of
SubIx, when an item appears multiple times in the subset which index should the function return?
Or should it be a "search" operation starting at a particular index
Code: Select all
SubIx( 'dimension', 'subset', 'element', starting_index )
and that way you could iterate through them.
Also as the function would not be available in rules (as rules have no idea of the existence of subsets and views) should it have a more TIish name?
SubsetFindElementIndex perhaps?
Re: Remove Element from a Subset
Posted: Tue Oct 09, 2012 10:30 pm
by Alan Kirk
Duncan P wrote:While we're on the subject of
SubIx, when an item appears multiple times in the subset which index should the function return?
Or should it be a "search" operation starting at a particular index
Code: Select all
SubIx( 'dimension', 'subset', 'element', starting_index )
and that way you could iterate through them.
Also as the function would not be available in rules (as rules have no idea of the existence of subsets and views) should it have a more TIish name?
SubsetFindElementIndex perhaps?
Good points, and good ideas. No, it definitely shouldn't be available in rules, despite the occasional person wanting to create subset-driven rules. (That way lies

) In an ideal world starting_index would be optional (most but not all subsets would probably contain unique elements unless someone has screwed up the definition of it) but starting_index would be a singularly useful addition for those cases where there were legitimate multiple appearances of element(s).