Probably this should be a very simple question, thank you

If it's only a zero out in the Prolog tab, I don't think it will matter a lot (dynamic vs. static subset).hyunjia wrote:Thanks for the prompt reply. It just occur to me during zero out cube, but the really focus is how I can insert all N element in subset , not just for cube clearing. Essential, I have heard so many bad things about MDX subset being slower than the static subset.
Did you see Kamil's method? Why would you need a different TI?hyunjia wrote:Yet, it seems the MDX would be no.1 options here and then probably would need another TI to turn it into a static subset though. Are there other tricks ?
The issue with MDX subsets is that they tend to recalculate themselves more often than needed and that this recalculation puts a lock on the dimension. With the solution described by me you only need 1 TI with 3 lines of code to get the desired result with only one recalculation of MDX, so it gives you the best of both worlds, really.hyunjia wrote:Yet, it seems the MDX would be no.1 options here and then probably would need another TI to turn it into a static subset though.
Would a zero out in the Prolog tab be faster using a-b-c versus only a ?qml wrote:Why, are dynamic subsets not to your liking?
The quickest way I can think of would be to:
a) create the dynamic subset using SubsetCreateByMDX();
b) use SubsetElementInsert() to insert a dummy element in that subset to implictly turn it to a static subset;
c) delete the dummy element from the subset.
And voila, you have yourself a static subset defined by whatever criteria you applied in step a.
Is that what you are after?
Ah okay, a more general discussion, then. Fine !qml wrote:I think you are focusing on the zeroout part too much, Wim. From what I understood the OP was asking for a more generic tip on subsets, not necessarily those used for view zeroouts.
Wim Gielis wrote:If it's only a zero out in the Prolog tab, I don't think it will matter a lot (dynamic vs. static subset).hyunjia wrote:Thanks for the prompt reply. It just occur to me during zero out cube, but the really focus is how I can insert all N element in subset , not just for cube clearing. Essential, I have heard so many bad things about MDX subset being slower than the static subset.
What is your concern? Speed, too much code, ... ?
Did you see Kamil's method? Why would you need a different TI?hyunjia wrote:Yet, it seems the MDX would be no.1 options here and then probably would need another TI to turn it into a static subset though. Are there other tricks ?
Wim Gielis wrote:Ah okay, a more general discussion, then. Fine !qml wrote:I think you are focusing on the zeroout part too much, Wim. From what I understood the OP was asking for a more generic tip on subsets, not necessarily those used for view zeroouts.
qml wrote:Why, are dynamic subsets not to your liking?
The quickest way I can think of would be to:
a) create the dynamic subset using SubsetCreateByMDX();
b) use SubsetElementInsert() to insert a dummy element in that subset to implictly turn it to a static subset;
c) delete the dummy element from the subset.
And voila, you have yourself a static subset defined by whatever criteria you applied in step a.
Is that what you are after?
qml wrote:Why, are dynamic subsets not to your liking?
The quickest way I can think of would be to:
a) create the dynamic subset using SubsetCreateByMDX();
b) use SubsetElementInsert() to insert a dummy element in that subset to implictly turn it to a static subset;
c) delete the dummy element from the subset.
And voila, you have yourself a static subset defined by whatever criteria you applied in step a.
Is that what you are after?
Fantastic piece of slight of hand Kamil. Thanks for sharing, you should make a post in the Useful forumqml wrote:
Why, are dynamic subsets not to your liking?
The quickest way I can think of would be to:
a) create the dynamic subset using SubsetCreateByMDX();
b) use SubsetElementInsert() to insert a dummy element in that subset to implictly turn it to a static subset;
c) delete the dummy element from the subset.
And voila, you have yourself a static subset defined by whatever criteria you applied in step a.
Is that what you are after?
Code: Select all
vDim='Projects';
vSub='test';
vFile='test_subset.cma';
If(SubsetGetSize(vDim,vSub)>0);
SubsetElementInsert(vDim,vSub,SubsetGetElementName(vDim,vSub,1),1);
AsciiOutput(vFile,NumberToString(SubsetGetSize(vDim,vSub)));
SubsetElementDelete(vDim,vSub,1);
AsciiOutput(vFile,NumberToString(SubsetGetSize(vDim,vSub)));
EndIf;
Wim Gielis wrote:Creating a dummy element is not needed. All subset updates are done immediately. No looping in this code.
My test code:
'test' is a dynamic subset containing only 1 element. So the first AsciiOutput gives 2 as the result, the second AsciiOutput gives 1, as expected.Code: Select all
vDim='Projects'; vSub='test'; vFile='test_subset.cma'; If(SubsetGetSize(vDim,vSub)>0); SubsetElementInsert(vDim,vSub,SubsetGetElementName(vDim,vSub,1),1); AsciiOutput(vFile,NumberToString(SubsetGetSize(vDim,vSub))); SubsetElementDelete(vDim,vSub,1); AsciiOutput(vFile,NumberToString(SubsetGetSize(vDim,vSub))); EndIf;
With this code, 'test' becomes a static subset (losing its MDX expression).