<html>
<head>
    <base href="https://docs.jboss.org/author">
            <link rel="stylesheet" href="/author/s/en/2172/19/5/_/styles/combined.css?spaceKey=TEIID&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://docs.jboss.org/author/display/TEIID/OLAP+Translator">OLAP Translator</a></h2>
    <h4>Page  <b>added</b> by             <a href="https://docs.jboss.org/author/display/~van.halbert">Van Halbert</a>
    </h4>
         <br/>
    <div class="notificationGreySide">
         <h1><a name="OLAPTranslator-"></a><font color="#000000"><b>OLAP Translator</b></font></h1>

<p><font color="#333333">The OLAP Services translator, known by the type name&nbsp;</font><font color="#333333"><em>olap</em></font><font color="#333333">, exposes stored procedures for calling analysis sevices backed by a OLAP server using MDX query lanaguage. This translator exposes a stored procedure, invokeMDX, that returns a result set containing tuple array values for a given MDX query. invokeMDX will commonly be used with the ARRAYTABLE table function to extract the results.</font></p>

<p><font color="#333333">Since the Cube metadata exposed by the OLAP servers and relational database metadata are so different, there is no single way to map the metadata from one to other. It is best to query OLAP system using its own native MDX language through. MDX queries my be defined statically or built dynamically in Teiid's abstraction layers.</font></p>

<h3><a name="OLAPTranslator-"></a><font color="#000000"><b>Usage</b></font></h3>

<p><font color="#333333">The olap translator exposes one low level procedure for accessing olap services.</font></p>

<h3><a name="OLAPTranslator-"></a><font color="#000000"><b>InvokeMDX Procedure</b></font></h3>

<p><font color="#333333"><tt>invokeMdx</tt></font><font color="#333333">&nbsp;returns a resultset of the tuples as array values.</font></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">Procedure invokeMdx(mdx in STRING, params VARIADIC OBJECT) returns table (tuple object)</pre>
</div></div>
<p><font color="#333333">The mdx parameter is a MDX query to be executed on the OLAP server.</font></p>

<p><font color="#333333">The results of the query will be returned such that each row on the row axis will be packed into an array value that will first contain each hierarcy member name on the row axis then each measure value from the column axis.</font></p>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><font color="#333333">The use of&nbsp;</font><font color="#005e8f">[<font color="#005e8f"></font>Data Roles</font>|Data Roles]<font color=""><font color="#333333"></font>&nbsp;should be considered to prevent arbitrary MDX from being submitted to the invokeMDX procedure.</font></td></tr></table></div>

<h3><a name="OLAPTranslator-"></a><font color="#000000"><b>Native Queries</b></font></h3>

<p><font color="#333333">OLAP source procedures may be created using the teiid_rel:native-query extension - see&nbsp;</font><font color="#005e8f">[<font color="#005e8f"></font>Parameterizable Native Queries</font>|#native]<font color=""><font color="#333333"></font>.</font></p>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><font color="#333333">The parameter value substitution directly inserts boolean, and number values, and treats all other values as string literals.</font></td></tr></table></div>
<p><font color="#333333">The procedure will invoke the native-query similar to an invokeMdx call with the benefits that the query is predetermined and that result column types are known, rather than requiring the use of ARRAYTABLE or similar functionality.</font></p>

<h4><a name="OLAPTranslator-"></a><font color="#000000"><b>Native Procedure</b></font></h4>

<p><font color="#333333">The invokeMdx procedure is the native procedure for the OLAP translator. It may be disabled or have it's name changed via the common native translator properties just like any other source. A call to a native procedure without any parameters will not attempt to parse the mdx query for parameterization. If parameters are used, the value substitution directly inserts boolean, and number values, and treats all other values as string literals.</font></p>

<h3><a name="OLAPTranslator-"></a><font color="#000000"><b>JCA Resource Adapter</b></font></h3>

<p><font color="#333333">The resource adapter for this translator provided through data source in JBoss AS, Refer to Admin Guide for "JDBC Data Sources" configuration section. Two sample &#45;ds.xml files provided for accessing OLAP servers in teiid-examples section. One is Mondrian specific, when Mondrian server is deloyed in the same JBoss AS as Teiid (mondrian-ds.xml). To access any other OLAP servers using XMLA interface, the data source for them can be created using them example template olap-xmla-ds.xml</font></p>
    </div>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;" class="grey">
                        <a href="https://docs.jboss.org/author/users/removespacenotification.action?spaceKey=TEIID">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://docs.jboss.org/author/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
       <a href="https://docs.jboss.org/author/display/TEIID/OLAP+Translator">View Online</a>
              |
       <a href="https://docs.jboss.org/author/display/TEIID/OLAP+Translator?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>