SORT the document column wise in REBEAN

HI,

I heard that there is a possibility of sorting throught the recordset in rebean.Can any foucs how can i achieve this.If Possible please provide me with a sample

thnx in advance
gsk


gsk (BOB member since 2004-05-24)

You can do it through SQLSelectStatement. Here is code snippet to handle it.

//.... dataProv is instance of DataProvider 
SQLDataProvider sqlProv =(SQLDataProvider) dataProv; 
SQLContainer cont = sqlProv.getSQLContainer(); 
SQLSelectStatement sqlSelect = (SQLSelectStatement)cont.getChildAt(0); 

String strNewSQL = "...//your new sql ..."; // your new SQL query goes here. Your new query should have sorting clause ORDER BY <column> ASC/DESC 

sqlSelect.setSQL(strNewSQL.toString()); 
boolean bValidate = sqlProv.validateSQL(); 
if(bValidate) 
{ 
    boolean bChange = sqlProv.changeSQL(); 
    if(bChange) 
   { 
       sqlProv.runQuery(); 

       Recordset rs = sqlProv.getResult(0); //this recordset has all records sorted by column name :) 
    } 
} 

chkk213 :india: (BOB member since 2006-07-28)

How can i pass this recordset to the DocumentInstance object? :hb:

How i change the report according to the sorted records?

plz help me or guide me.

Cheers,
SAK


sakshi :india: (BOB member since 2006-10-10)

I don’t think you can pass a com.businessobjects.rebean.wi.Recordset to document Instance.

What I was doing in my code snippet is that I was trying to run the query and get the Recordset. So that, I can iterate through the Recordset…(I have my own UI for table to display the data in the Recordset)

I think you don’t need

Recordset rs = sqlProv.getResult(0);

to display you report sorted by any column.
go for webservices API to display report…


chkk213 :india: (BOB member since 2006-07-28)

i could not find any sort method/interface/class in the webservices SDK for sorting the report according to column values :hb:

but i can do it for LOVs…

how can i do it for column values??

plz plz plz help me or guide me

Thank you,
SAK


sakshi :india: (BOB member since 2006-10-10)

i have done this, but i’m unable to get the recordset according to new SQL, and the record set generated is based on the old SQL(i.e default SQL specific to that report)

i’m using both dataprovider’s runQuery() and SQLdataprovider runQuery() methods.

can u plz let me know how can i do this .??

Is it neccessary to have our own UI for table to display??? or is there any option that we can modify the existing reports recordset??

plz help me or guide me

Cheers,
SAK.


sakshi :india: (BOB member since 2006-10-10)

Hi Sakshi

These steps are really important to make your customized query run, once you’ve the new query in hand.

  1. validateSQL()
  2. changeSQL()
  3. Run the query

boolean bValidate = sqlProv.validateSQL();
if(bValidate)
{
boolean bChange = sqlProv.changeSQL();
if(bChange)
{
sqlProv.runQuery();

   Recordset rs = sqlProv.getResult(0); //this recordset has all records sorted by column name :) 
} 

}

Basically my reqmt was more of getting raw recordsets in the sorted order w.r.t any column. Since I have my own Table builder, I used it to display data…

is there any option that we can modify the existing reports recordset?? 

We get recordsets only after successfully running the query. 'am not sure if it’s really possible to modify the existing report, I don’t think it would solve the purpose.


chkk213 :india: (BOB member since 2006-07-28)

Dear Chkk,
can we do this type of functionality by using webservices?


nrkmca (BOB member since 2006-08-28)

Correction. It was taken in wrong way… I mentioned Webservices SDK only for retrieving HTML/XML format of report…

I don’t think you can do sort functionality by using Webservices SDK

REBEAN SDK would solve the problem.


chkk213 :india: (BOB member since 2006-07-28)