If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

TI Process delete elements from DIMENSION based on Subset

Started by donap, 21 Sep 2018 12:55:27 PM

Previous topic - Next topic

donap

I need help with the following scenario:

Data Source Tab – Subset
Dimension and "ALL" subset selected 

PROLOG TAB -
Logic to create a temporary Subset, populated with
Elements that meet a certain business criteria.

I am outputting a ASCII text file to capture the elements selected.
I have all lines in  METADATA , DATA and EPILOG commented out EXCEPT some debugging ASCII OUTPUT

In my Test data,  I have ** CORRECTLY** populated the subset with 3 elements.
The ASCII output and the contents of the Subset are **CORRECT**

>>> HERE IS THE PART I NEED HELP WITH <<<
In the Metadata Tab (or should it be the  data tab?? )
I want to DELETE the elements identified by being in this newly created Subset  from the DIMENSION COMPLETELY.

I want to loop through the Elements in the Subset, then delete that element from the Dimension.
In this case, it would perform 3 deletes. 
I cannot figure out how to use the Subset to control which elements from ALL get deleted.

I am confused if my DATA SOURCE should be the ALL or the Subset (using this code at the end of PROLOG)
#=== Set Data Source
DatasourceType = 'SUBSET';
DatasourceNameForServer = pDimension;
DatasourceDimensionSubset = pSubset ;

Eventually (after Debugging) , the EPILOG tab will destroy the Subset.

A few trial and errors results:
1>  identified EVERY ELEMENT in the "ALL" set for deletion (wrote it to Text file)
2>  Deleted ONE of the 3 elements, then attempted to delete the SAME element 2 more times (a total of 3 ) which led me to believe there was only an issue with advancing the element...
     but my change got me back to <1>.
TIA !

donap

I got it finally!

at End of Prolog Tab :

#=== Set Data Source
DatasourceType = 'SUBSET';
DatasourceNameForServer = pDimension;
DatasourceDimensionSubset = pSubset ;
  nSubsetSize = 1;         <=====================
   nSubsetSize = SubsetGetSize( pDimension, pSubset) ;




Simple Metadata Tab
#=== Start
If ( nSubsetIndex <= nSubsetSize );
        sElement = SubsetGetElementName( pDimension,   pSubset   , nSubsetIndex );
       
         sMessage = 'Dimension: ' | pDimension | ' -- ' |   sElement  | ' > identified to Delete';
         AsciiOutput( sDebugFile2, sMessage );
               
                  If( pOption@= 'Delete' );
                       DimensionElementDelete( pDimension, sElement );
                  endif;   
   
Endif ;

   nSubsetIndex = nSubsetIndex +1;
           
#== End Metadata