Dynamic MDX queries

  • Am very interested to hear if anyone else has encoutnered (and solved!) the following.

    Using a dynamic query to pass MDX to analysis services, I am letting users select parameter values which are then used in the dynmic query.  Because I'm using the 'NON EMPTY' keyword(s) in the MDX, on occasion the users select parms for which no data is returned.  This would be great if AS actually returned a 'no data' dataset, but it appears that the AS server is so intelligent that it throws an error/exception indicating that it can't return anything as one of the axes would be empty.  This error is not caught within RS and so displays directly back to the end user (who has no idea what it means).

    Any ideas on workarounds, ways to catch the error etc will be gratefully accepted.

     

    Steve.

  • How did the parameter values populated in the select list? Use dataset to populate it.

  • Params were all populated by datasets, so no issue there.  The problem is the equivalent of using a TSQL query with a where clause for which there were no records.  The difference is that MSSQL returns an empty dataset/recordset.  Analysis services seems to catch the fact that an axis would be empty so returns nothing (but an error/exception).  I need t be able to catch this exception.

    Steve.

  • Not catch the error, but avoid it.

    article

    ms-help://MS.MSDNQTR.2004OCT.1033/dnsql2k/html/olapasandrs.htm has some workaround on the issue.

  • Thanks, I had read this (well skimmed it anyway) but went back and re-read (re-skimmed) again.  It doesn't hold the solution per se, but did make me re-think what I was doing.  I basically got this solved by removing the 'NON EMPTY' for the columns as I was returning only the measures in the columns, so a non-empty on the rows is/was all that's required. 

    Thanks for prompting me to go back to it again.

    Steve.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply