I'm trying to write a generic routine that create the MDX automatically depend on the user's selection. The problem I'm facing is when the user is selecting too many values of one particular dimension.
Are you trying to write a utility/routine that actually generates MDX code? And is the utility itself written in another language?
I think I need to see some specifics of what you're trying to do. Thanks