Page 1 of 1

Problem with delete subset

Posted: Tue Oct 08, 2013 2:42 pm
by G.Frimen
Have difficult with delete a Subset from all Cube dimensions have only param name cube and name subset.
Can anyone help?

Re: Problem with delete subset

Posted: Tue Oct 08, 2013 4:02 pm
by qml
G.Frimen wrote:Can anyone help?
I'd love to, but I have no idea what you are asking for, so please spend the time needed to explain it properly and clearly.

If you mean that knowing the cube name you want to find all the dimensions in that cube and then delete all subsets for these dimensions with a specific name, then you want to use a combination of TABDIM function in a WHILE loop to figure out the subsequent dimensions with SubsetExists and SubsetDestroy.

Re: Problem with delete subset

Posted: Tue Oct 08, 2013 4:47 pm
by lotsaram
qml wrote:If you mean that knowing the cube name you want to find all the dimensions in that cube and then delete all subsets for these dimensions with a specific name, then you want to use a combination of TABDIM function in a WHILE loop to figure out the subsequent dimensions with SubsetExists and SubsetDestroy.
If Kamil's clairvoyant skills are spot on then this will do it.

Code: Select all

IF( ViewExists( cCub, sZeroView ) = 1 );
  ViewDestroy( cCub, sZeroView );
EndIF;

nDim = 1;
While( TabDim( cCub, nDim ) @<> '' );
  sDim = TabDim( cCub, nDim );
  IF( SubsetExists( sDim, sZeroSub ) = 1 );
    SubsetDestroy( sDim, sZeroSub );
  EndIF;
  nDim = nDim + 1;
End;
But really I have no idea what your question says. If Kamil hadn't made what looks to be a good guess from your question I and probably others would have been less polite in directing you to pay more attention to framing a sensible question - otherwise how can you realistically expect to get help. It behooves the person asking for assistance to to the groundwork, not leave others to do it!

Re: Problem with delete subset

Posted: Wed Oct 09, 2013 11:59 am
by G.Frimen
lotsaram wrote:
qml wrote:If you mean that knowing the cube name you want to find all the dimensions in that cube and then delete all subsets for these dimensions with a specific name, then you want to use a combination of TABDIM function in a WHILE loop to figure out the subsequent dimensions with SubsetExists and SubsetDestroy.
If Kamil's clairvoyant skills are spot on then this will do it.

Code: Select all

IF( ViewExists( cCub, sZeroView ) = 1 );
  ViewDestroy( cCub, sZeroView );
EndIF;

nDim = 1;
While( TabDim( cCub, nDim ) @<> '' );
  sDim = TabDim( cCub, nDim );
  IF( SubsetExists( sDim, sZeroSub ) = 1 );
    SubsetDestroy( sDim, sZeroSub );
  EndIF;
  nDim = nDim + 1;
End;
But really I have no idea what your question says. If Kamil hadn't made what looks to be a good guess from your question I and probably others would have been less polite in directing you to pay more attention to framing a sensible question - otherwise how can you realistically expect to get help. It behooves the person asking for assistance to to the groundwork, not leave others to do it!
THANKS!!! greatly work, that process that I'm looking!

Re: Problem with delete subset

Posted: Wed Oct 09, 2013 5:38 pm
by Wim Gielis
Kamil, don't forget to play the lottery, your guesses are awesome !