Handling issues when MDX queries are invalid

There are many reasons an MDX query generated by the OLAP Engine may be invalid.  If the query is created by the slice-and-dice user interface errors are less likely but if the cube behind has changed saved reports may no longer be valid.

More common for me is to be creating reports manually and making a mistake.  Here's a StackBlitz link to an example.

As you will see in the example, the error is never reported.  The user only knows there is a problem because the spinner does not stop.

Of course, I can fix my problem.  But is there a better way to handle these conditions?  If there's an error with the MDX, Analysis Services will report the error in its response.  Is there a mechanism to grab the error message?

Thanks.


12 Replies

RG Rajeshkannah G Syncfusion Team August 15, 2023 11:24 AM UTC

Hi Bill,


We regret to inform you that we currently do not have an option to capture the error message when MDX queries are invalid.


Please let us know if you have any concerns.


Regards,

Rajeshkannah Gopalakrishnan



BS Bill Seddon August 15, 2023 11:58 AM UTC

OK.  But is there some what to handle the error?  When Analysis Services responds with an error, the ./olap/olapEngine implementation handles it but suppresses which means even Syncfusion's PivotView code is unable to update its user interface or let the user know.

Surely something better can be done?



AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team August 16, 2023 07:02 PM UTC

Hi Bill,


Currently, we have “actionFailure” event in Pivot Table that will be triggered to display an error message when we do UI actions in the pivot table that are not successfully completed at runtime. However, currently we are facing an issue that actionfailure event not thrown error during initial rendering. We believe that this failure event will fulfil your need. Thus, we have logged this as a bug " Exception not throw when OLAP cube data fetch with improper MDX query during initial rendering". And the fix for this issue will be included in our August last weekly release which is scheduled to be rolled out on August 30, 2023. You can track the status with the feedback link below.


Feedback: https://www.syncfusion.com/feedback/46150/exception-not-throw-when-olap-cube-data-fetch-with-improper-mdx-query-during


Regards,

Angelin Faith Sheeba.



BS Bill Seddon August 17, 2023 03:16 PM UTC

Thanks for the update.  You guys provide great support.  It's great to know it will be possible to respond to an error condition.



AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team August 30, 2023 03:30 PM UTC

Hi Bill,


Sorry for the inconvenience. We are now unable to extract error information at the client-side from the OLAP cube because we acquire the cell information from the OLAP as XMLA (SOAP-based XML). To obtain error information from the service, we must first confirm the possibilities with our current SOAP structure. As a result, we considered your request as an improvement. Because we are already working on high priority items for our upcoming 2023 Vol 3 release, this requirement will be available in our 2023 Vol 4 release, which is estimated to be rolled out at the end of December 2023.


We appreciate your patience until then.


Regards,

Angelin Faith Sheeba.



BS Bill Seddon August 30, 2023 04:29 PM UTC

Thanks for the update.  



AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team December 20, 2023 01:54 PM UTC

Hi Bill,


We apologize for not being able to include this feature request in our Vol 4 main release as promised due to other high priority items already in the queue for consideration. However, considering your importance as priority, we will include this feature in our upcoming 2024 Volume 4 SP release which is estimated to be rolled out at end of January, 2024. You can track the status of this using the below feedback.


Feedback:
https://www.syncfusion.com/feedback/46150/exception-not-throw-when-olap-cube-data-fetch-with-improper-mdx-query-during


We appreciate your patience until then.


Regards,

Angelin Faith Sheeba



AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team February 1, 2024 12:39 PM UTC

Hi Bill,


Thank you for the patience. We are glad to announce that our Essential Studio 2023 Volume 4 SP Release V24.2.3 is rolled out and the improvement “Exception not throw when OLAP cube data fetch with improper MDX query during initial renderinghas been included in this release. And now you can able to view the error information using the actionFailure event. Please refer the below code example.


Code Example:

 actionFailure: function(args){

      // You can capture the error information here.

        console.log(args.errorInfo);

    },


Output screenshot:


Meanwhile, we have prepared a sample for your reference.


Sample: https://stackblitz.com/edit/ar7ws8-2zq7dx?file=index.html,index.js


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.


Regards,

Angelin Faith Sheeba.



BS Bill Seddon February 3, 2024 10:15 PM UTC

Perfect.  Thanks.  That work and we are now able to respond to errors from AS.



AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team February 5, 2024 05:41 AM UTC

Hi Bill,


Thanks for the update. Please contact us if you have any other queries. We are always happy to assist you.


Regards,

Angelin Faith Sheeba.



BS Bill Seddon February 6, 2024 01:18 AM UTC

Hi, having worked with the fix, I've come across an introduced problem.  Let me know if this should be a new ticket.

The issue is within the function doAjaxPost of ./src/base/olap/engine.js. This function contains the line:


    if (!body.querySelector('DiscoverResponse').querySelector('return').querySelector('row')) { ... }


In most cases, checking the <return> element has at least one <row> element is a good idea.  However, it is possible for a CUBE to have no named sets.  To check for named sets the OLAPEngine generates the request:


<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">

  <Header/>

    <Body>

      <Discover xmlns="urn:schemas-microsoft-com:xml-analysis">

        <RequestType>MDSCHEMA_SETS</RequestType>

        <Restrictions>

          <RestrictionList>

            <CATALOG_NAME>Quarterly</CATALOG_NAME>

            <CUBE_NAME>Outcomes_flow_combined</CUBE_NAME>

          </RestrictionList>

        </Restrictions>

        <Properties>

          <PropertyList>

            <Catalog>Quarterly</Catalog>

            <LocaleIdentifier>1033</LocaleIdentifier>

          </PropertyList>

        </Properties>

      </Discover>

   </Body>

</Envelope>


When the query is sent to one of our cubes which has no named sets, the response below is received.  It's valid and correct but because it does not include <row> elements the condition in the 'doAjaxPost' function creates an error.  My solution is to set 

_this.errorList = null;


in the function 'loadNamedSetElements'.


<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

<soap:Body>

<DiscoverResponse xmlns="urn:schemas-microsoft-com:xml-analysis" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100="http://schemas.microsoft.com/analysisservices/2008/engine/100" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200" xmlns:ddl300="http://schemas.microsoft.com/analysisservices/2011/engine/300" xmlns:ddl300_300="http://schemas.microsoft.com/analysisservices/2011/engine/300/300" xmlns:ddl400="http://schemas.microsoft.com/analysisservices/2012/engine/400" xmlns:ddl400_400="http://schemas.microsoft.com/analysisservices/2012/engine/400/400" xmlns:ddl410="http://schemas.microsoft.com/analysisservices/2012/engine/410" xmlns:ddl410_410="http://schemas.microsoft.com/analysisservices/2012/engine/410/410">

<return>

<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msxmla="http://schemas.microsoft.com/analysisservices/2003/xmla">

<xsd:schema targetNamespace="urn:schemas-microsoft-com:xml-analysis:rowset" xmlns:sql="urn:schemas-microsoft-com:xml-sql" elementFormDefault="qualified">

<xsd:element name="root">

<xsd:complexType>

<xsd:sequence minOccurs="0" maxOccurs="unbounded">

<xsd:element name="row" type="row"/>

</xsd:sequence>

</xsd:complexType>

</xsd:element>

<xsd:simpleType name="uuid">

<xsd:restriction base="xsd:string">

<xsd:pattern value="[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:complexType name="xmlDocument">

<xsd:sequence>

<xsd:any/>

</xsd:sequence>

</xsd:complexType>

<xsd:complexType name="row">

<xsd:sequence>

<xsd:element sql:field="CATALOG_NAME" name="CATALOG_NAME" type="xsd:string" minOccurs="0"/>

<xsd:element sql:field="SCHEMA_NAME" name="SCHEMA_NAME" type="xsd:string" minOccurs="0"/>

<xsd:element sql:field="CUBE_NAME" name="CUBE_NAME" type="xsd:string" minOccurs="0"/>

<xsd:element sql:field="SET_NAME" name="SET_NAME" type="xsd:string" minOccurs="0"/>

<xsd:element sql:field="SCOPE" name="SCOPE" type="xsd:int" minOccurs="0"/>

<xsd:element sql:field="DESCRIPTION" name="DESCRIPTION" type="xsd:string" minOccurs="0"/>

<xsd:element sql:field="EXPRESSION" name="EXPRESSION" type="xsd:string" minOccurs="0"/>

<xsd:element sql:field="DIMENSIONS" name="DIMENSIONS" type="xsd:string" minOccurs="0"/>

<xsd:element sql:field="SET_CAPTION" name="SET_CAPTION" type="xsd:string" minOccurs="0"/>

<xsd:element sql:field="SET_DISPLAY_FOLDER" name="SET_DISPLAY_FOLDER" type="xsd:string" minOccurs="0"/>

<xsd:element sql:field="SET_EVALUATION_CONTEXT" name="SET_EVALUATION_CONTEXT" type="xsd:int" minOccurs="0"/>

</xsd:sequence>

</xsd:complexType>

</xsd:schema>

</root>

</return>

</DiscoverResponse>

</soap:Body>

</soap:Envelope






AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team February 6, 2024 02:18 PM UTC

Hi Bill,


We have created a separate forum to track the “Pivot table throws an error and breaks while connecting an OLAP cube with no named set” issue. Please follow the below forum for further follow up.


Forum: https://forumassist.syncfusion.com/186589


Please let us know if you have any concerns.


Regards,

Angelin Faith Sheeba.


Loader.
Up arrow icon