Your SlideShare is downloading. ×
Xml4js pentaho
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Xml4js pentaho

996

Published on

Xmla4js is a standalone javascript library that provides basic XML for Analysis (XML/A) capabilities, allowing javascript developers to access data and metadata from OLAP provides for use in rich …

Xmla4js is a standalone javascript library that provides basic XML for Analysis (XML/A) capabilities, allowing javascript developers to access data and metadata from OLAP provides for use in rich (web) applications. Xmla4js can be used inside a webpage or in a server environment like node.js

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
996
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. https://github.com/rpbouman/xmla4js.git X4js MLA X4js MLA X4js MLA
  • 2. https://github.com/rpbouman/xmla4js.git Xmla4js Overview ● Standalone XML/A client API in JavaScript ● Based on the XML/A standard ● Works with Pentaho, also works with – Palo (Jedox), MS Analysis Services, Essbase ● http://github.com/rpbouman/xmla4js.git
  • 3. https://github.com/rpbouman/xmla4js.git A Simple OLAP Query SELECT [Measures].[Profit] ON COLUMNS, [Product].[All Products].Children ON ROWS FROM [Sales] Measures Profit Drink $ 29,358.98 Food $245,764.87 Non-Consumable $ 64,487.05
  • 4. https://github.com/rpbouman/xmla4js.git Xmla in the Browser<script type=”text/javascript”> var url = "http://localhost:8080/pentaho/Xmla?userid=joe&password=password"; var datasource = "Pentaho Analysis Services"; var catalog = "FoodMart"; var mdx = "SELECT [Measures].[Profit] ON COLUMNS," + " [Product].[All Products].Children ON ROWS " + "FROM [Sales]"; var request = "<SOAP-ENV:Envelope" + " xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"" + " SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">" + " <SOAP-ENV:Body>" + " <Execute" + " xmlns="urn:schemas-microsoft-com:xml-analysis"" + " SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">" + " <Command>" + " <Statement>" + mdx + "</Statement>" + " </Command>" + " <Properties>" + " <PropertyList>" + " <DataSourceInfo>" + datasource + "</DataSourceInfo>" + " <Catalog>" + catalog + "</Catalog>" + " <Format>Tabular</Format>" + " </PropertyList>" + " </Properties>" + " </Execute>" + " </SOAP-ENV:Body>" + "</SOAP-ENV:Envelope>"; var xhr = new XMLHttpRequest(); xhr.open("POST", url, false); xhr.setRequestHeader("Content-Type", "text/xml"); xhr.send(request); var response = xhr.responseXML; var rows = response.getElementsByTagNameNS( "urn:schemas-microsoft-com:xml-analysis:rowset", "row" ); var colHeaders = response.getElementsByTagNameNS( "urn:schemas-microsoft-com:xml-analysis:rowset", "row" ); var rowArray = []; for (var i=0; i<rows.length; i++){ var row = rows.item(i); var cols = row.getElementsByTagName("*"); var rowArrayEntry = {}; rowArray.push(rowArrayEntry); for (var j=0; j<cols.length; j++){ var col = cols.item(j); rowArrayEntry[col.nodeName] = col.firstChild.data } } </script>
  • 5. https://github.com/rpbouman/xmla4js.git Xmla4js in the Browser <script type="text/javascript" src="../src/Xmla.js"></script> <script type="text/javascript"> var rowArray = new Xmla().execute({ async: false, url: "http://localhost:8080/pentaho/Xmla", statement: "SELECT [Measures].[Profit] ON COLUMNS," + " [Product].[All Products].Children ON ROWS "+ "FROM [Sales]", properties: { DataSourceInfo: "Pentaho Analysis Services", Catalog: "FoodMart", Format: "Tabular" } }).fetchAllAsObject(); </script> [ {"[Product].[Product Family].[MEMBER_CAPTION]":"Drink", "[Measures].[Profit]":29358.9754} , {"[Product].[Product Family].[MEMBER_CAPTION]":"Food", "[Measures].[Profit]":245764.86650000003} , {"[Product].[Product Family].[MEMBER_CAPTION]":"Non-Consumable", "[Measures].[Profit]":64487.0545} ]
  • 6. https://github.com/rpbouman/xmla4js.git Xmla4js Calling Sequence ServerClient Discover Schema Rowset (metadata) Model (metadata) Visualization (data) Request type, restrictions Statement (MDX) Execute Multidimensional Resultset (data)
  • 7. https://github.com/rpbouman/xmla4js.git Xmla4js Classes Xmla addListener() executeXXX() discoverXXX() setOptions Rowset eachRow() fetchAllXXX() fetchAsXXX() fieldCount() fieldDef() hasMoreRows() mapAllAsObject() mapAsObject() nextRow() readAsXXX() reset() Dataset axisCount() fetchAsObject() getAxis() getCellset() Axis eachHierarchy() eachTuple() fetchAllXXX() fetchAsXXX() getTuple() hierarchy() member() Cellset cellCount() cellOrdinalForTupleIndexes() getByXXX() hasMoreCells() eachCell() nextCell() readCell()
  • 8. https://github.com/rpbouman/xmla4js.git Well documented ● Samples ● API documentation – YUI doc system for nodejs
  • 9. https://github.com/rpbouman/xmla4js.git Easy to integrate ● No dependencies ● AMD en CommonJS module compliant ● Runs in browsers as well as Node.js
  • 10. https://github.com/rpbouman/xmla4js.git Undogmatic and Flexible ● setOptions or pass config object per request ● Listeners vs Callbacks ● generic vs specific requests ● Synchronous vs asynchronous ● Programmatic vs raw requests / responses ● Bulk collection or manual iteration of results ● Collect results as arrays, objects or custom ● Iteration through iterators or loops
  • 11. https://github.com/rpbouman/xmla4js.git setOptions vs config object var xmla = new Xmla({ url: "http://localhost:8080/pentaho/Xmla", }); xmla.setOptions({ async: false, requestTimeout: 30000 }); xmla.discoverDataSources({ async: false, requestTimeout: 30000 });
  • 12. https://github.com/rpbouman/xmla4js.git addListener vs request callbacks xmla.addListener(name, handler[, scope]); xmla.addListener({ event: "discover", handler: function(event, data, xmla){ ... }, }, { events: ["error", "success"], handler: function(event, data, xmla){ ... } }); xmla.addListener({ request: function(event, data, xmla){ ... }, error: function(event, data, xmla){ ... }, success: function(event, data, xmla){ ... }, scope: ... }); xmla.discoverDataSources({ success: function(xmla, request, response){ ... }, error: function(xmla, request, exception){ ... }, callback: function( event, xmla, request, data ){ ... } });
  • 13. https://github.com/rpbouman/xmla4js.git Generic vs specific requests xmla.request({ method: "Discover", requestType: "DISCOVER_DATASOURCES" }); xmla.discover({ requestType: "DISCOVER_DATASOURCES" }); xmla.request({ method: "Execute", statement: "SELECT FROM SteelWheelsSales", properties: { DataSourceInfo: "Pentaho", Catalog: "SteelWheels" } }); xmla.execute({ statement: "SELECT FROM SteelWheelsSales", properties: { DataSourceInfo: "Pentaho", Catalog: "SteelWheels", Format: "Multidimensional" } }); xmla.execute({ statement: "SELECT FROM SteelWheelsSales", properties: { DataSourceInfo: "Pentaho", Catalog: "SteelWheels", Format: "Tabular" } }); xmla.discoverDataSources(); xmla.executeMultiDimensional({ statement: "SELECT FROM SteelWheelsSales", properties: { DataSourceInfo: "Pentaho", Catalog: "SteelWheels" } }); xmla.executeTabular({ statement: "SELECT FROM SteelWheelsSales", properties: { DataSourceInfo: "Pentaho", Catalog: "SteelWheels" } });

Ă—