Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
DataCube Primary DataSet
Karol Zglejszewski
<p>Hello,</p>
<p>How can I changing DataCube Primary DataSet depending of local parameter in Initialize Script?</p>
<p> </p>
<p>Karol</p>
Find more posts tagged with
Comments
JFreeman
<p>What version of BIRT are you using?<br>
What is your use case?</p>
<p> </p>
<p>If you change the primary data set, you are most likely then going to also need to change all of the mappings on the cube to to align with the new primary data set. At that point, you are getting rather close to essentially dynamically generating the entire cube.</p>
Karol Zglejszewski
<p>This is my version of Birt</p>
<p>Version: Kepler Service Release 1<br>
Build id: 20130919-0819<br>
</p>
<p>I would like to do something like that in initialize script:</p>
<p> </p>
<p>I have got 1 parameter with posible values : a1 and a2</p>
<p>I have got 2 data sets d1 and d2</p>
<p>and I have got 1 DataCube with Primary dataset d1, but I would like to changing it in initialize script (if parameter value = a1, set DataCube Primary dataset d1, and if parameter value =a2, set DataCube Primary dataset d2</p>
<p> </p>
<p>Regards,</p>
<p>Karol Zglejszewski</p>
JFreeman
<p>Using this approach, you are also going to have to dynamically change the cubes group an summary fields to be mapped to the new primary data set. This means you would also have to then dynamically modify any elements that are built from the data cube to be bound to the new groups and summaries you have modified in the data cube.</p>
<p> </p>
<p>I think a better approach may be to have 2 data cubes and then two crosstabs, etc. built from said data cubes. Then, depending on the parameter selected, dynamically hide or drop the elements that are not bound to the selected data cube.</p>
Karol Zglejszewski
<p>I know that Your solution is possible, but i want to do it in the script</p>
JFreeman
<p>To start, you can hook the cube associated the this crosstab using code like the following:</p>
<pre class="_prettyXprint _lang-js">
reportContext.getDesignHandle().findElement("myCrosstab").getReportItem().getCube()
</pre>
<p>This returns a TabularCubeHandle object which can then be used to set the Data Set of the cube.</p>
<p>The API docs are going to be your best resource. You can start with the doc on the TabularCubeHandle here: <a data-ipb='nomediaparse' href='
http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.birt.doc.isv/model/api/org/eclipse/birt/report/model/api/olap/TabularCubeHandle.html'>http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.birt.doc.isv/model/api/org/eclipse/birt/report/model/api/olap/TabularCubeHandle.html</a></p>
;