Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Table Sorting(Sorting Does not happen on runtime)
Table Sorting [message #733697] Wed, 05 October 2011 12:50 Go to next message
vandhanaa.r is currently offline vandhanaa.rFriend
Messages: 18
Registered: July 2011
Junior Member
Using the BIRT Designer version 2.1.3
BIRT runtime 2.2.2

My problem is when i click on the table header of a particular column ,the table gets sorted according to the sort order of that column in BIRT designer preview , but not in runtime.
Here is what code tried with help of this forum.

beforeFactory -
sortkeyCriteria =reportContext.getHttpServletRequest().getRequestURL() + "?" +reportContext.getHttpServletRequest().getQueryString();

Table Header URI option script is
importPackage(Packages.java.lang);

var temp = sortkeyCriteria ;
var targetURL = new String();

if(temp.indexOf("_overwrite=") != -1 ){

targetURL = temp.substring(0, temp.indexOf("&_overwrite") -1);
}else{
targetURL = temp;
}

targetURL += "&_overwrite=true";
targetURL += "&_srt=a";

Sort Key - selecting the sort key based on the click of column,

if( params["srt"].value =="Column1" ){
row["Column1"];
}
else if(params["srt"].value =="Column2"){
row["Column2"];
}
else if(params["srt"].value =="Column3"){
row["Column3"];
}

Sort Direction - Ascending

Can anyone let me know where am i going wrong
Re: Table Sorting [message #733759 is a reply to message #733697] Wed, 05 October 2011 14:56 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you post the whole report?

Jason

On 10/5/2011 8:50 AM, vandhanaa.r wrote:
> Using the BIRT Designer version 2.1.3
> BIRT runtime 2.2.2
>
> My problem is when i click on the table header of a particular column
> ,the table gets sorted according to the sort order of that column in
> BIRT designer preview , but not in runtime.
> Here is what code tried with help of this forum.
>
> beforeFactory - sortkeyCriteria
> =reportContext.getHttpServletRequest().getRequestURL() + "?"
> +reportContext.getHttpServletRequest().getQueryString();
>
> Table Header URI option script is importPackage(Packages.java.lang);
>
> var temp = sortkeyCriteria ;
> var targetURL = new String();
>
> if(temp.indexOf("_overwrite=") != -1 ){
>
> targetURL = temp.substring(0, temp.indexOf("&_overwrite") -1);
> }else{
> targetURL = temp;
> }
>
> targetURL += "&_overwrite=true";
> targetURL += "&_srt=a";
>
> Sort Key - selecting the sort key based on the click of column,
>
> if( params["srt"].value =="Column1" ){
> row["Column1"];
> }
> else if(params["srt"].value =="Column2"){
> row["Column2"];
> }
> else if(params["srt"].value =="Column3"){
> row["Column3"];
> }
>
> Sort Direction - Ascending
> Can anyone let me know where am i going wrong
Re: Table Sorting [message #734394 is a reply to message #733759] Fri, 07 October 2011 16:00 Go to previous messageGo to next message
vandhanaa.r is currently offline vandhanaa.rFriend
Messages: 18
Registered: July 2011
Junior Member
Attached with this the report

Thanks Jason !
Re: Table Sorting [message #734415 is a reply to message #734394] Fri, 07 October 2011 16:52 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you try:

importPackage(Packages.java.lang);
var temp = xyz;
var targetURL = new String();

if(temp.indexOf("&__overwrite=") != -1 ){

targetURL = temp.substring(0, temp.indexOf("&__overwrite="));
}else{
targetURL = temp;
}
targetURL += "&__overwrite=true";
targetURL += "&srt=column3";

and take the var keyword off of counter in the table prepare script:

counter = 0;


Jason

On 10/7/2011 12:00 PM, vandhanaa.r wrote:
> Attached with this the report
>
> Thanks Jason !
Re: Table Sorting [message #734420 is a reply to message #734415] Fri, 07 October 2011 17:29 Go to previous messageGo to next message
vandhanaa.r is currently offline vandhanaa.rFriend
Messages: 18
Registered: July 2011
Junior Member
I tried the __overwrite instead of _overwrite in my original report but still sorting not working in the runtime.

The counter was part of the table for a different thing (not for sorting).

I am using the BIRT 2.2.2 runtime default web.xml . By default the _Overrite attribute will be set to true right . Any changes needed in web.xml ?
Re: Table Sorting [message #734434 is a reply to message #734420] Fri, 07 October 2011 18:31 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

What happens when you click on it?

Jason

On 10/7/2011 1:29 PM, vandhanaa.r wrote:
> I tried the __overwrite instead of _overwrite in my original report but
> still sorting not working in the runtime.
>
> The counter was part of the table for a different thing (not for sorting).
>
> I am using the BIRT 2.2.2 runtime default web.xml . By default the
> _Overrite attribute will be set to true right . Any changes needed in
> web.xml ?
Re: Table Sorting [message #734509 is a reply to message #734434] Sat, 08 October 2011 04:17 Go to previous messageGo to next message
vandhanaa.r is currently offline vandhanaa.rFriend
Messages: 18
Registered: July 2011
Junior Member
When i click on it , nothing happens , just the page gets refreshed in runtime.
But it works fine in Viewer.

Does it has anything to do with handling the gethttpRequest in the beforeFactory() method ?

Re: Table Sorting [message #734972 is a reply to message #734509] Mon, 10 October 2011 14:33 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I thought it was failing in the viewer? How are you running it when it
fails. You can always log out some debug info in the beforeFactory to
check it. Use something like"

importPackage( Packages.java.io );
out = new PrintWriter( new FileWriter( "c:/temp/rpevents.txt", true ) );
out.println( "beforeFactory " + addyourvariableshere);
out.close();

Jason

On 10/8/2011 12:17 AM, vandhanaa.r wrote:
> When i click on it , nothing happens , just the page gets refreshed in
> runtime. But it works fine in Viewer.
>
> Does it has anything to do with handling the gethttpRequest in the
> beforeFactory() method ?
>
>
Re: Table Sorting [message #734980 is a reply to message #734972] Mon, 10 October 2011 15:01 Go to previous messageGo to next message
vandhanaa.r is currently offline vandhanaa.rFriend
Messages: 18
Registered: July 2011
Junior Member
Jason,

I tried debug the before factory() , i did not get any errors.
Re: Table Sorting [message #735070 is a reply to message #734980] Mon, 10 October 2011 20:27 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Did you print out the url?

Jason

On 10/10/2011 11:01 AM, vandhanaa.r wrote:
> Jason,
> I tried debug the before factory() , i did not get any errors.
Previous Topic:Web tool platform
Next Topic:How to filter the results on the basis of list box in report?
Goto Forum:
  


Current Time: Sun Dec 21 09:59:39 GMT 2014

Powered by FUDForum. Page generated in 0.01789 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software