Extracting the resultset problem. [message #207522] |
Wed, 20 December 2006 02:30  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
>>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05913 seconds