The following will be part of release 1.3.7...
This function returns true if the current command executing which triggered this sproc is a DISCOVER or a MDSCHEMA command. For example, if you define a dynamic set in the MDX script, it will be evaluated when the user connects in Excel so that Excel can determine
which dimension folder to display the set under. Changing the dynamic set definition as follows will allow the set to communicate that it's part of the Product dimension without incurring the expense of evaluating the TopCount function until actually used
in a real query. (This is usually unnecessary, but if the TopCount expression is already optimized with aggregations and it is causes unacceptable slowness when the user connects Excel, this is a workaround.)
Create Dynamic Set CurrentCube.[Top 25 Selling Products] As
Display_Folder = 'Sets';
This sproc also provides a function call which returns the string which is the currently executing command.
Note: These sprocs are not available in Analysis Services 2005 because Context.CurrentConnection.SessionID isn't available in sprocs in AS2005. It is available in later versions of SSAS.