Skip to main content



      Home
Home » Archived » BIRT » Extracting the resultset problem.
Extracting the resultset problem. [message #207522] Wed, 20 December 2006 02:30 Go to next message
Eclipse UserFriend
Hi,

I am trying to extract the result sets from the reportdocument file by using
IDataExtraction task. The sql query contains 3 columns as part of select.
However, when I iterate through the resultset to print the data, I only get
one column. Is the resultset dependent on which table it's bound to in the
designer? Here is my sample code:

IReportDocument iReportDocument = engine.openReportDocument(reportDocument);
//Create Data Extraction Task
IDataExtractionTask iDataExtract =
engine.createDataExtractionTask(iReportDocument);
//Get list of result sets
ArrayList resultSetList =
(ArrayList)iDataExtract.getResultSetList( );
if (resultSetList.size() > 0) {
for (int rIndex = 0; rIndex < resultSetList.size(); rIndex++ ) {
IResultSetItem resultItem =
(IResultSetItem)resultSetList.get(rIndex);
String dispName = resultItem.getResultSetName( );
iDataExtract.selectResultSet( dispName );
IExtractionResults iExtractResults = iDataExtract.extract();
try {
if ( iExtractResults != null ) {
IDataIterator iData =
iExtractResults.nextResultIterator( );
IResultMetaData metaData =
iData.getResultMetaData();
int numberOfCols = metaData.getColumnCount();
//iterate through the results
if ( iData != null ) {
while (iData.next( )) {
for (int i=0; i < numberOfCols; i++) {
System.out.println((iData.getValue(i));
}

}
iData.close();
}

}
}catch( Exception e){
Logging.error("Error ", e);
}
}
}
iDataExtract.close();

Though the sql statement contains 3 columns, while designing the report, I
create complex groupby aggregation etc. Does it affect the resultset?
Any help would be appreciated. Is there anyother way, where I can access the
resultsets?

Thanks
Re: Extracting the resultset problem. [message #207920 is a reply to message #207522] Wed, 20 December 2006 22:26 Go to previous messageGo to next message
Eclipse UserFriend
Data Extracts work on report items, so if you want the whole sql resultset
available bind it to a table. You dont display the values.

Jason

"Bidyut Pattanayak" <bidyut@yahoo.com> wrote in message
news:emaorl$rvr$1@utils.eclipse.org...
> Hi,
>
> I am trying to extract the result sets from the reportdocument file by
> using IDataExtraction task. The sql query contains 3 columns as part of
> select. However, when I iterate through the resultset to print the data, I
> only get one column. Is the resultset dependent on which table it's bound
> to in the designer? Here is my sample code:
>
> IReportDocument iReportDocument =
> engine.openReportDocument(reportDocument);
> //Create Data Extraction Task
> IDataExtractionTask iDataExtract =
> engine.createDataExtractionTask(iReportDocument);
> //Get list of result sets
> ArrayList resultSetList =
> (ArrayList)iDataExtract.getResultSetList( );
> if (resultSetList.size() > 0) {
> for (int rIndex = 0; rIndex < resultSetList.size(); rIndex++ )
> {
> IResultSetItem resultItem =
> (IResultSetItem)resultSetList.get(rIndex);
> String dispName = resultItem.getResultSetName( );
> iDataExtract.selectResultSet( dispName );
> IExtractionResults iExtractResults =
> iDataExtract.extract();
> try {
> if ( iExtractResults != null ) {
> IDataIterator iData =
> iExtractResults.nextResultIterator( );
> IResultMetaData metaData =
> iData.getResultMetaData();
> int numberOfCols = metaData.getColumnCount();
> //iterate through the results
> if ( iData != null ) {
> while (iData.next( )) {
> for (int i=0; i < numberOfCols; i++) {
> System.out.println((iData.getValue(i));
> }
>
> }
> iData.close();
> }
>
> }
> }catch( Exception e){
> Logging.error("Error ", e);
> }
> }
> }
> iDataExtract.close();
>
> Though the sql statement contains 3 columns, while designing the report, I
> create complex groupby aggregation etc. Does it affect the resultset?
> Any help would be appreciated. Is there anyother way, where I can access
> the resultsets?
>
> Thanks
>
Re: Extracting the resultset problem. [message #208079 is a reply to message #207920] Thu, 21 December 2006 14:32 Go to previous message
Eclipse UserFriend
Thanks. That's what I was assuming.


"Jason Weathersby" <jweathersby@actuate.com> wrote in message
news:emcust$95k$1@utils.eclipse.org...
> Data Extracts work on report items, so if you want the whole sql resultset
> available bind it to a table. You dont display the values.
>
> Jason
>
> "Bidyut Pattanayak" <bidyut@yahoo.com> wrote in message
> news:emaorl$rvr$1@utils.eclipse.org...
>> Hi,
>>
>> I am trying to extract the result sets from the reportdocument file by
>> using IDataExtraction task. The sql query contains 3 columns as part of
>> select. However, when I iterate through the resultset to print the data,
>> I only get one column. Is the resultset dependent on which table it's
>> bound to in the designer? Here is my sample code:
>>
>> IReportDocument iReportDocument =
>> engine.openReportDocument(reportDocument);
>> //Create Data Extraction Task
>> IDataExtractionTask iDataExtract =
>> engine.createDataExtractionTask(iReportDocument);
>> //Get list of result sets
>> ArrayList resultSetList =
>> (ArrayList)iDataExtract.getResultSetList( );
>> if (resultSetList.size() > 0) {
>> for (int rIndex = 0; rIndex < resultSetList.size(); rIndex++ )
>> {
>> IResultSetItem resultItem =
>> (IResultSetItem)resultSetList.get(rIndex);
>> String dispName = resultItem.getResultSetName( );
>> iDataExtract.selectResultSet( dispName );
>> IExtractionResults iExtractResults =
>> iDataExtract.extract();
>> try {
>> if ( iExtractResults != null ) {
>> IDataIterator iData =
>> iExtractResults.nextResultIterator( );
>> IResultMetaData metaData =
>> iData.getResultMetaData();
>> int numberOfCols = metaData.getColumnCount();
>> //iterate through the results
>> if ( iData != null ) {
>> while (iData.next( )) {
>> for (int i=0; i < numberOfCols; i++) {
>>
>> System.out.println((iData.getValue(i));
>> }
>>
>> }
>> iData.close();
>> }
>>
>> }
>> }catch( Exception e){
>> Logging.error("Error ", e);
>> }
>> }
>> }
>> iDataExtract.close();
>>
>> Though the sql statement contains 3 columns, while designing the report,
>> I create complex groupby aggregation etc. Does it affect the resultset?
>> Any help would be appreciated. Is there anyother way, where I can access
>> the resultsets?
>>
>> Thanks
>>
>
>
Previous Topic:Update Troubles
Next Topic:Security for BIRT viewer in J2EE web app
Goto Forum:
  


Current Time: Tue Jul 22 14:26:52 EDT 2025

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

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

Back to the top