subset creation moved to epilog and worked
Posted: Mon Aug 14, 2017 2:13 pm
Hi Guys,
I had an issue with subset creation and when I moved a part of code to epilog it started working. Can you tel me if there was anything wrong having the code in prolog itself .
Prolog : Creating a subset through a mdx statement .
Subset Name : ALL X Customers
Now with All X customers subset as reference creating an another subset with some filter add to it .
vSize = SUBSETGETSIZE( vDimensionName, vSourceSubset );
WHILE( vSize > 0 );
vElement = SUBSETGETELEMENTNAME( vDimensionName, vSourceSubset, vSize );
vCustomerGrade = CELLGETS( 'AR History', vElement, 'US01', vPeriod, 'All Currencies', 'Local Currency', '120000', 'All Customer Types', 'Letter Grade' );
IF( vCustomerGrade @= 'F' );
SUBSETELEMENTINSERT( vDimensionName, vSubsetName, vElement, 1 );
ENDIF;
vSize = vSize - 1;
END;
Now both these subsets work great . I now add a third subset below this line of code in prolog which is also built from the 1 st subset as a base .
vSubsetName = 'All Y customers';
vSourceSubset = 'ALL X Customers';
vDimensionName = 'Customers SoldTo';
vSourceDim = 'Customers SoldTo Only';
IF( SUBSETEXISTS( vDimensionName, vSubsetName ) = 1 );
SUBSETDELETEALLELEMENTS( vDimensionName, vSubsetName );
ELSE;
SUBSETCREATE( vDimensionName, vSubsetName );
ENDIF;
vSize = SUBSETGETSIZE( vSourceDim, vSourceSubset );
WHILE( vSize > 0 );
vElement = SUBSETGETELEMENTNAME( vSourceDim, vSourceSubset, vSize );
IF( DIMIX( vDimensionName, vElement ) = 0 );
ITEMREJECT( 'The Specified Customer DNE in the Customers SoldTo Dimension: ' | vElement );
ELSE;
SUBSETELEMENTINSERT( vDimensionName, vSubsetName, vElement, 1 );
ENDIF;
vSize = vSize - 1;
END;
Now the subset All Y customers is partially created when the code is in prolog and is fully created when the code is in epilog(bold code in epilog now) .
Is the reference of the main subset not released in pro log . Not sure why this is happening .
Any suggestions are welcome .
I had an issue with subset creation and when I moved a part of code to epilog it started working. Can you tel me if there was anything wrong having the code in prolog itself .
Prolog : Creating a subset through a mdx statement .
Subset Name : ALL X Customers
Now with All X customers subset as reference creating an another subset with some filter add to it .
vSize = SUBSETGETSIZE( vDimensionName, vSourceSubset );
WHILE( vSize > 0 );
vElement = SUBSETGETELEMENTNAME( vDimensionName, vSourceSubset, vSize );
vCustomerGrade = CELLGETS( 'AR History', vElement, 'US01', vPeriod, 'All Currencies', 'Local Currency', '120000', 'All Customer Types', 'Letter Grade' );
IF( vCustomerGrade @= 'F' );
SUBSETELEMENTINSERT( vDimensionName, vSubsetName, vElement, 1 );
ENDIF;
vSize = vSize - 1;
END;
Now both these subsets work great . I now add a third subset below this line of code in prolog which is also built from the 1 st subset as a base .
vSubsetName = 'All Y customers';
vSourceSubset = 'ALL X Customers';
vDimensionName = 'Customers SoldTo';
vSourceDim = 'Customers SoldTo Only';
IF( SUBSETEXISTS( vDimensionName, vSubsetName ) = 1 );
SUBSETDELETEALLELEMENTS( vDimensionName, vSubsetName );
ELSE;
SUBSETCREATE( vDimensionName, vSubsetName );
ENDIF;
vSize = SUBSETGETSIZE( vSourceDim, vSourceSubset );
WHILE( vSize > 0 );
vElement = SUBSETGETELEMENTNAME( vSourceDim, vSourceSubset, vSize );
IF( DIMIX( vDimensionName, vElement ) = 0 );
ITEMREJECT( 'The Specified Customer DNE in the Customers SoldTo Dimension: ' | vElement );
ELSE;
SUBSETELEMENTINSERT( vDimensionName, vSubsetName, vElement, 1 );
ENDIF;
vSize = vSize - 1;
END;
Now the subset All Y customers is partially created when the code is in prolog and is fully created when the code is in epilog(bold code in epilog now) .
Is the reference of the main subset not released in pro log . Not sure why this is happening .
Any suggestions are welcome .