Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Designing Analytics Reports
Birt Report runtime column sorting, how to avoid multiple database calls
Migrateduser
<p>Hi,</p><p> </p><p>I am using below script on "<strong>initialize</strong>" of my report and on each column header I am setting <strong>Hyperlink </strong> location as "<strong>targetURL +"table_name.columnName</strong>";"</p><p> </p><p>The runtime column sorting is working fine however each time I click column header it makes database call again and fetch data from database. I am new to BIRT can anyone help me how to avoid multiple database calls on clicking column header to sort the data?</p><p> </p><p> </p><p><span style="font-size:12px;">dataSetName = "Data_Set_Name";
sortCol = reportContext.getHttpServletRequest().getParameter("sortCol");
sortDir = reportContext.getHttpServletRequest().getParameter("sortDir");
currentURL = reportContext.getHttpServletRequest().getRequestURL() + "?" +
reportContext.getHttpServletRequest().getQueryString();
sortClause = "";
targetURL = "";
abbrSortCol = "";
if (sortDir != null)
{
if (sortDir.indexOf("ASC") != -1)
sortDir = "DESC";
else
sortDir = "ASC";
}
else
sortDir = "ASC";
if (sortCol != null && sortCol.length != 0)
{
sortClause = " ORDER BY " + sortCol + " " + sortDir;
lastIndex = sortCol.lastIndexOf(".");
if (lastIndex == -1)
abbrSortCol = sortCol;
else
abbrSortCol = sortCol.substring(lastIndex + 1);
}
reportContext.getReportRunnable().getDesignInstance().
getDataSet(dataSetName).queryText += sortClause;
if (currentURL.indexOf("__sorting=") != -1 )
targetURL = currentURL.substring(0, currentURL.indexOf("__sorting") - 1);
else
targetURL = currentURL;
targetURL = targetURL + "&__sorting=true&sortDir=" + sortDir + "&sortCol=";</span></p>
Find more posts tagged with
Comments
There are no comments yet