I’m building a generic helper class to flatten an ADOMD data set to a data table for easier consumption by default and third party .NET controls. I can’t rely on the Load method of the data table, nor the CellSet object as in some cases not all the information is persisted; datatypes and top level hierarchies to name two.
To persist all of the information I need to traverse the actual xml dataset returned by the ExecuteXMLReader method of the ADOMDCommand object.
I don’t use xml enough these days to remember all the nuances with namespaces and it took me a little while to work out what to set the namespaces to in order for the ‘SelectNodes’ method to work.
Below is the code snippet I used to ensure the output from the ExecuteXmlReader method is fully traversable.
// Execute the command returning the XML data set
XmlReader reader = command.ExecuteXmlReader();
// Load the object into an XML document
XmlDocument xml = new XmlDocument();
xml.Load(reader);
// Create an XML namespace manager
System.Xml.XmlNamespaceManager nsManager=new XmlNamespaceManager(xml.NameTable);
// Add the namepsaces to the manager
nsManager.AddNamespace(“defaultNS”,”urn:schemas-microsoft-com:xml-analysis:mddataset”);
nsManager.AddNamespace(“xsi”,http://www.w3.org/2001/XMLSchema-instance);
nsManager.AddNamespace(“xsd”,http://www.w3.org/2001/XMLSchema);
// Return a list of nodes that represent the row information
XmlNodeList rows = xml.SelectNodes(“defaultNS:root/defaultNS:Axes/defaultNS:Axis[@name =’Axis1′]”, nsManager);
This kb article helped me out a bit:
http://support.microsoft.com/default.aspx?scid=kb;en-gb;q318545
There are some more goodies included in my helper class that I will blog about in the future, once it’s stable !
Pareto Charts in Power BI and the DAX behind them
The Pareto principle, commonly referred to as the 80/20 rule, is a concept of prioritisation.
Apr
Databricks: Cluster Configuration
Databricks, a cloud-based platform for data engineering, offers several tools that can be used to
Apr
AI Assistance in Microsoft Fabric
The exponential growth of Large Language Models (LLMs) couples with Microsoft’s close partnership with OpenAI
Apr
10 reasons why it’s worth the effort to understand the value of your data
“If leaders really want to create a data driven culture, the journey starts with them!
Apr
Content Safety in Azure AI Studio
Azure AI Content Safety is a solution designed to identify harmful content, whether generated by
Apr
Model Benchmarks in Azure AI Studio
In the constantly changing field of artificial intelligence (AI) and machine learning (ML), choosing the
Apr
Celebrating International Women’s Day: from Classroom to Code
As we celebrate International Women’s Day, I want to share my journey of breaking stereotypes
Mar
Pretty Power BI – Adding Pagination to Bar Charts
Good User Experience (UX) design is crucial in enabling stakeholders to maximise the insights that
Feb