Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Arranging Columns and Rows in Crosstabs
ChristopheXx
<p>Hello! As titled, currently, the crosstab displays the columns and rows in alphabetic order. Is there any way to change the order of the columns and rows of the crosstabs to my desire?</p>
<p> </p>
<p> </p>
<p>For example,</p>
<p> </p>
<p>Columns -> Forest | Lake | Plains | River</p>
<p>Change To -> Forest | Plains | Lake | River</p>
Find more posts tagged with
Comments
micajblock
<p>Is this OS BIRT using Data Cubes or Commercial BIRT using a Data Model?</p>
ChristopheXx
<p>Pardon, not sure about that but should be commercial BIRT.</p>
micajblock
<p>The I will try to answer as best I can. In any case you need to create a computed field that will be used for you custom sort.</p>
<p> </p>
<p>If you are using data cubes create the computed field in the data set. Then in the data cube you set the dimension to be the computed field and in the properties set the display field to be your real field.</p>
<p> </p>
<p>f you are using data models create the computed field in the data model. The in the crossbar you have 2 dimensions first the computed field (to set the sort) then the real field. You then set the visibility on the computed to hide it always.</p>
ChristopheXx
<p>Thanks for the reply. I am using Data Cubes. May I ask how do I create this computed field in the data set?</p>
micajblock
<p>Here. See image. So you should create a computed field of type of integer with n expression like this:</p>
<div>
<pre class="_prettyXprint">
if (row["fieldname"]=="Forest") {
1;
}
else if (row["fieldname"]=="Plains") {
2;
}
else if (row["fieldname"]=="Lake") {
3;
}
elseif (row["fieldname"]=="River") {
4;
}</pre>
</div>
<p> </p>
ChristopheXx
<p>Thanks for the reply
. However, I am sorry but it seems like the BIRT I am using is OS BIRT. I can't find the computed columns tab in my data set. Could you teach me the method for OS BIRT?</p>
micajblock
<p>Computed columns is part of the data set in OS BIRT as well. Can you show me a screen shot? Also what version of BIRT are you using? What is the data source?</p>
ChristopheXx
<p><a data-ipb='nomediaparse' href='
https://www.dropbox.com/s/fk5lvc9cil6krvn/DataSetSS.png?dl=0'>https://www.dropbox.com/s/fk5lvc9cil6krvn/DataSetSS.png?dl=0</a></p>
;
<p> </p>
<p>The BIRT version is 4.3.1 and the datasource is a Maximo data source.</p>
micajblock
<p>Well that explains it as Maximo uses a scripted Data Source which does not have computed columns. So here is what you need to do. In the data set output columns add a field with a type of integer named 'SortOrder'. Then in the fetch method before the line return true add this (replace 'fieldname' with the original field that has your data):</p>
<div>
<pre class="_prettyXprint">
if (row["fieldname"]=="Forest") {
row["SortOrder"]=1;
}
else if (row["fieldname"]=="Plains") {
row["SortOrder"]=2;
}
else if (row["fieldname"]=="Lake") {
row["SortOrder"]=3;
}
else if (row["fieldname"]=="River") {
row["SortOrder"]=4;
}</pre>
</div>
ChristopheXx
<p>Hi, thank you very much for the advice. The sorting works, but now the column names are 0,1, 2 and 3. How do I rename them to display as Forest, Plains, Lake and River?</p>
micajblock
<p>Change the display field in the dimension. See attached image.</p>
ChristopheXx
<p>Yay~~ It works. Thank you very much!!</p>