Home » Archived » BIRT » DataExtractionTask sometimes returns duplicate records
DataExtractionTask sometimes returns duplicate records [message #149336] |
Wed, 29 March 2006 18:24  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_003C_01C65344.D2F91AA0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I have the following method (which I copied from the ReportEngineService =
class and then customized) which runs and formats a report for CSV =
format. Most of the time it works fine, but occasionally I have noticed =
that it returns duplicate records. Any idea why this is happening? A =
test of this code returns the following results (Note: the last row is a =
duplicate):
Department,Hours Available,Total Assigned,Assignment Expired,Taken by =
Assigned,Taken by Other,Agent Exited,Customer Exited
assignmenttester,0.0,0.0,0.0,0.0,0.0,0.0
Bogus Department,0.0,0.0,0.0,0.0,0.0,0.0
Bogus DPT,0.0,0.0,0.0,0.0,0.0,0.0
boo,0.0,0.0,0.0,0.0,0.0,0.0
Buenos Dias DayCare,0.0,0.0,0.0,0.0,0.0,0.0
CG Image Test,0.0,0.0,0.0,0.0,0.0,0.0
CG Image Test 2,0.0,0.0,0.0,0.0,0.0,0.0
Chinese ?? (Simplified),0.0,0.0,0.0,0.0,0.0,0.0
Danish,0.0,0.0,0.0,0.0,0.0,0.0
Default,5.0,2.0,3.0,0.0,0.0,0.0
Default,5.0,2.0,3.0,0.0,0.0,0.0
public String getCSVReport(String resultSet, String[] columnHeaders, =
Map params)
{
IExtractionResults results =3D null;
IDataIterator iData =3D null;
String resultData =3D "";
StringBuffer buf =3D new StringBuffer( );
try
{
IRunTask runTask =3D m_birtEngine.getRunTask(m_report);
runTask.setParameterValues(params);
runTask.run(BIRT_REPORTS_FOLDER + m_reportName + REPORT_DOC_EXT);
IReportDocument doc =3D =
m_birtEngine.getReportDocument(BIRT_REPORTS_FOLDER + m_reportName + =
REPORT_DOC_EXT);
=20
IDataExtractionTask task =3D =
m_birtEngine.getDataExtractionTask(doc);
=20
task.selectResultSet(resultSet);
task.setLocale(Locale.ENGLISH);
results =3D task.extract();
=20
if ( columnHeaders.length !=3D 0 && results !=3D null )
{
iData =3D results.nextResultIterator( );
IResultMetaData md =3D iData.getResultMetaData();
=20
if ( iData !=3D null )
{
buf.append(columnHeaders[0]);
=20
for ( int i =3D 1; i < columnHeaders.length; i++ )
{
buf.append( ',' ); //$NON-NLS-1$
buf.append(columnHeaders[i]);
}
=20
buf.append("\n");
// Data
while ( iData.next( ) )
{
String value =3D null;
=20
try
{
value =3D cvsConvertor( ( String ) DataTypeUtil
.convert( iData.getValue( =
md.getColumnName(0) ), DataType.STRING_TYPE ) );
}
catch ( Exception e )
{
value =3D null;
}
if ( value !=3D null )
{
buf.append( value );
}
=20
for ( int i =3D 1; i < md.getColumnCount(); i++ )
{
buf.append( ',' ); //$NON-NLS-1$
=20
try
{
value =3D cvsConvertor( ( String ) =
DataTypeUtil
.convert( iData.getValue( =
md.getColumnName(i) ), DataType.STRING_TYPE ) );
}
catch ( Exception e )
{
value =3D null;
}
=20
if ( value !=3D null )
{
buf.append( value );
}
}
=20
buf.append("\n");
=20
}
}
}
=20
}
catch(Exception e)
{
System.out.println("Exception extracting report data: " + e);
}
=20
resultData =3D buf.toString( );
buf.delete( 0, buf.length( ) );
return resultData;
=20
}
------=_NextPart_000_003C_01C65344.D2F91AA0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2802" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>I have the following method (which I =
copied from=20
the ReportEngineService class and then customized) which runs and =
formats a=20
report for CSV format. Most of the time it works fine, but =
occasionally I=20
have noticed that it returns duplicate records. Any idea why this =
is=20
happening? A test of this code returns the following results =
(Note: the=20
last row is a duplicate):</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>
<P>Department,Hours Available,Total Assigned,Assignment Expired,Taken by =
Assigned,Taken by Other,Agent Exited,Customer Exited</P>
<P>assignmenttester,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Bogus Department,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Bogus DPT,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>boo,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Buenos Dias DayCare,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>CG Image Test,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>CG Image Test 2,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Chinese ?? (Simplified),0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Danish,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Default,5.0,2.0,3.0,0.0,0.0,0.0</P>
<P>Default,5.0,2.0,3.0,0.0,0.0,0.0</P></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> <FONT face=3D"Times New =
Roman">public String=20
getCSVReport(String resultSet, String[] columnHeaders, Map =
params)<BR> =20
{<BR> IExtractionResults results =3D =
null;<BR> =20
IDataIterator iData =3D null;<BR> String resultData =
=3D=20
"";<BR> StringBuffer buf =3D new StringBuffer(=20
);</FONT></FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2> try<BR> =20
{<BR> IRunTask runTask =3D=20
m_birtEngine.getRunTask(m_report);<BR> =20
runTask.setParameterValues(params);<BR> =20
runTask.run(BIRT_REPORTS_FOLDER + m_reportName +=20
REPORT_DOC_EXT);<BR> IReportDocument doc =
=3D=20
m_birtEngine.getReportDocument(BIRT_REPORTS_FOLDER + m_reportName +=20
REPORT_DOC_EXT);<BR> <BR> =
IDataExtractionTask=20
task =3D=20
m_birtEngine.getDataExtractionTask(doc);<BR>  =
;=20
<BR> =20
task.selectResultSet(resultSet);<BR> =20
task.setLocale(Locale.ENGLISH);<BR> =
results =3D=20
task.extract();<BR> =20
<BR> if ( columnHeaders.length !=3D 0 =
&&=20
results !=3D null )<BR> =20
{<BR> iData =3D=20
results.nextResultIterator( =
);<BR> =20
IResultMetaData md =3D=20
iData.getResultMetaData();<BR> =
<BR> if ( iData !=3D null=20
)<BR> =20
{<BR> =20
buf.append(columnHeaders[0]);<BR> &nbs=
p; &nbs p;=20
<BR> &nb=
sp; =20
for ( int i =3D 1; i < columnHeaders.length; i++=20
)<BR> &n=
bsp; =20
{<BR> &n=
bsp; =20
buf.append( ',' );=20
//$NON-NLS-1$<BR> &n=
bsp; &n bsp; =20
buf.append(columnHeaders[i]);<BR> &nbs=
p; &nbs p;=20
}<BR> &n=
bsp; =20
<BR> &nb=
sp; =20
buf.append("\n");</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
size=3D2> &nbs=
p; =20
//=20
Data<BR>  =
; =20
while ( iData.next( )=20
)<BR> &n=
bsp; =20
{<BR> &n=
bsp; =20
String value =3D=20
null;<BR> &nbs=
p; &nbs p;=20
<BR> &nb=
sp; =20
try<BR> =
=20
{<BR> &n=
bsp; &n bsp; =20
value =3D cvsConvertor( ( String )=20
DataTypeUtil<BR> &nb=
sp; &nb sp; &nb s=
p; &nbs p; =20
..convert( iData.getValue( md.getColumnName(0) ), DataType.STRING_TYPE )=20
);<BR> &=
nbsp; =20
}<BR> &n=
bsp; =20
catch ( Exception e=20
)<BR> &n=
bsp; =20
{<BR> &n=
bsp; &n bsp; =20
value =3D=20
null;<BR> &nbs=
p; &nbs p;=20
}</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
size=3D2> &nbs=
p; &nbs p;=20
if ( value !=3D null=20
)<BR> &n=
bsp; =20
{<BR> &n=
bsp; &n bsp; =20
buf.append( value=20
);<BR> &=
nbsp; =20
}<BR> &n=
bsp; =20
<BR> &nb=
sp; =20
for ( int i =3D 1; i < md.getColumnCount(); i++=20
)<BR> &n=
bsp; =20
{<BR> &n=
bsp; &n bsp; =20
buf.append( ',' );=20
//$NON-NLS-1$<BR> &n=
bsp; &n bsp; =20
<BR> &nb=
sp; &nb sp; =20
try<BR> =
=20
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
value =3D cvsConvertor( ( String )=20
DataTypeUtil<BR> &nb=
sp; &nb sp; &nb s=
p; &nbs p; =20
..convert( iData.getValue( md.getColumnName(i) ), DataType.STRING_TYPE )=20
);<BR> &=
nbsp; & nbsp; =20
}<BR> &n=
bsp; &n bsp; =20
catch ( Exception e=20
)<BR> &n=
bsp; &n bsp; =20
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
value =3D=20
null;<BR> &nbs=
p; &nbs p; =20
}<BR> &n=
bsp; &n bsp; =20
<BR> &nb=
sp; &nb sp; =20
if ( value !=3D null=20
)<BR> &n=
bsp; &n bsp; =20
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
buf.append( value=20
);<BR> &=
nbsp; & nbsp; =20
}<BR> &n=
bsp; =20
}<BR> &n=
bsp; =20
<BR> &nb=
sp; =20
buf.append("\n");<BR> &nbs=
p; &nbs p; =20
<BR> &nb=
sp; =20
}<BR> =20
}<BR> }<BR> =20
<BR> }<BR> catch(Exception=20
e)<BR> {<BR> =20
System.out.println("Exception extracting report data: " +=20
e);<BR> =
}<BR> =20
<BR> resultData =3D buf.toString( =
);<BR> =20
buf.delete( 0, buf.length( ) );<BR> return=20
resultData;<BR> <BR> =
}</FONT></DIV></BODY></HTML>
------=_NextPart_000_003C_01C65344.D2F91AA0--
|
|
|
Re: DataExtractionTask sometimes returns duplicate records [message #149605 is a reply to message #149336] |
Thu, 30 March 2006 08:21   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0063_01C653D2.E2A50160
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Does this happen with every result set? If not can you verify the data?
Jason
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0f4up$cf$1@utils.eclipse.org...
I have the following method (which I copied from the =
ReportEngineService class and then customized) which runs and formats a =
report for CSV format. Most of the time it works fine, but occasionally =
I have noticed that it returns duplicate records. Any idea why this is =
happening? A test of this code returns the following results (Note: the =
last row is a duplicate):
Department,Hours Available,Total Assigned,Assignment Expired,Taken by =
Assigned,Taken by Other,Agent Exited,Customer Exited
assignmenttester,0.0,0.0,0.0,0.0,0.0,0.0
Bogus Department,0.0,0.0,0.0,0.0,0.0,0.0
Bogus DPT,0.0,0.0,0.0,0.0,0.0,0.0
boo,0.0,0.0,0.0,0.0,0.0,0.0
Buenos Dias DayCare,0.0,0.0,0.0,0.0,0.0,0.0
CG Image Test,0.0,0.0,0.0,0.0,0.0,0.0
CG Image Test 2,0.0,0.0,0.0,0.0,0.0,0.0
Chinese ?? (Simplified),0.0,0.0,0.0,0.0,0.0,0.0
Danish,0.0,0.0,0.0,0.0,0.0,0.0
Default,5.0,2.0,3.0,0.0,0.0,0.0
Default,5.0,2.0,3.0,0.0,0.0,0.0
public String getCSVReport(String resultSet, String[] columnHeaders, =
Map params)
{
IExtractionResults results =3D null;
IDataIterator iData =3D null;
String resultData =3D "";
StringBuffer buf =3D new StringBuffer( );
try
{
IRunTask runTask =3D m_birtEngine.getRunTask(m_report);
runTask.setParameterValues(params);
runTask.run(BIRT_REPORTS_FOLDER + m_reportName + =
REPORT_DOC_EXT);
IReportDocument doc =3D =
m_birtEngine.getReportDocument(BIRT_REPORTS_FOLDER + m_reportName + =
REPORT_DOC_EXT);
=20
IDataExtractionTask task =3D =
m_birtEngine.getDataExtractionTask(doc);
=20
task.selectResultSet(resultSet);
task.setLocale(Locale.ENGLISH);
results =3D task.extract();
=20
if ( columnHeaders.length !=3D 0 && results !=3D null )
{
iData =3D results.nextResultIterator( );
IResultMetaData md =3D iData.getResultMetaData();
=20
if ( iData !=3D null )
{
buf.append(columnHeaders[0]);
=20
for ( int i =3D 1; i < columnHeaders.length; i++ )
{
buf.append( ',' ); //$NON-NLS-1$
buf.append(columnHeaders[i]);
}
=20
buf.append("\n");
// Data
while ( iData.next( ) )
{
String value =3D null;
=20
try
{
value =3D cvsConvertor( ( String ) DataTypeUtil
.convert( iData.getValue( =
md.getColumnName(0) ), DataType.STRING_TYPE ) );
}
catch ( Exception e )
{
value =3D null;
}
if ( value !=3D null )
{
buf.append( value );
}
=20
for ( int i =3D 1; i < md.getColumnCount(); i++ )
{
buf.append( ',' ); //$NON-NLS-1$
=20
try
{
value =3D cvsConvertor( ( String ) =
DataTypeUtil
.convert( iData.getValue( =
md.getColumnName(i) ), DataType.STRING_TYPE ) );
}
catch ( Exception e )
{
value =3D null;
}
=20
if ( value !=3D null )
{
buf.append( value );
}
}
=20
buf.append("\n");
=20
}
}
}
=20
}
catch(Exception e)
{
System.out.println("Exception extracting report data: " + e);
}
=20
resultData =3D buf.toString( );
buf.delete( 0, buf.length( ) );
return resultData;
=20
}
------=_NextPart_000_0063_01C653D2.E2A50160
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2769" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Does this happen with every result =
set? If=20
not can you verify the data?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Jason</FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> wrote in =
message=20
<A=20
=
href=3D"news:e0f4up$cf$1@utils.eclipse.org">news:e0f4up$cf$1@utils.eclips=
e.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>I have the following method (which I =
copied from=20
the ReportEngineService class and then customized) which runs and =
formats a=20
report for CSV format. Most of the time it works fine, but =
occasionally=20
I have noticed that it returns duplicate records. Any idea why =
this is=20
happening? A test of this code returns the following results =
(Note: the=20
last row is a duplicate):</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>
<P>Department,Hours Available,Total Assigned,Assignment Expired,Taken =
by=20
Assigned,Taken by Other,Agent Exited,Customer Exited</P>
<P>assignmenttester,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Bogus Department,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Bogus DPT,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>boo,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Buenos Dias DayCare,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>CG Image Test,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>CG Image Test 2,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Chinese ?? (Simplified),0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Danish,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Default,5.0,2.0,3.0,0.0,0.0,0.0</P>
<P>Default,5.0,2.0,3.0,0.0,0.0,0.0</P></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> <FONT face=3D"Times New =
Roman">public String=20
getCSVReport(String resultSet, String[] columnHeaders, Map =
params)<BR> =20
{<BR> IExtractionResults results =3D=20
null;<BR> IDataIterator iData =3D =
null;<BR> =20
String resultData =3D "";<BR> StringBuffer buf =3D =
new=20
StringBuffer( );</FONT></FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2> try<BR> =20
{<BR> IRunTask runTask =3D=20
m_birtEngine.getRunTask(m_report);<BR> =20
runTask.setParameterValues(params);<BR> =20
runTask.run(BIRT_REPORTS_FOLDER + m_reportName +=20
REPORT_DOC_EXT);<BR> IReportDocument doc =
=3D=20
m_birtEngine.getReportDocument(BIRT_REPORTS_FOLDER + m_reportName +=20
REPORT_DOC_EXT);<BR> <BR> =20
IDataExtractionTask task =3D=20
=
m_birtEngine.getDataExtractionTask(doc);<BR>  =
;=20
<BR> =20
task.selectResultSet(resultSet);<BR> =20
task.setLocale(Locale.ENGLISH);<BR> =
results =3D=20
task.extract();<BR> =20
<BR> if ( columnHeaders.length !=3D 0 =
&&=20
results !=3D null )<BR> =20
{<BR> iData =3D=20
results.nextResultIterator( =
);<BR> =20
IResultMetaData md =3D=20
=
iData.getResultMetaData();<BR> =
<BR> if ( iData !=3D null=20
)<BR> =20
=
{<BR> =20
=
buf.append(columnHeaders[0]);<BR> &nbs=
p; &nbs p;=20
=
<BR> &nb=
sp; =20
for ( int i =3D 1; i < columnHeaders.length; i++=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; =20
buf.append( ',' );=20
=
//$NON-NLS-1$<BR> &n=
bsp; &n bsp; =20
=
buf.append(columnHeaders[i]);<BR> &nbs=
p; &nbs p;=20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
buf.append("\n");</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
=
size=3D2> &nbs=
p; =20
//=20
=
Data<BR>  =
; =20
while ( iData.next( )=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; =20
String value =3D=20
=
null;<BR> &nbs=
p; &nbs p;=20
=
<BR> &nb=
sp; =20
=
try<BR> =
=20
=
{<BR> &n=
bsp; &n bsp; =20
value =3D cvsConvertor( ( String )=20
=
DataTypeUtil<BR> &nb=
sp; &nb sp; &nb s=
p; &nbs p; =20
.convert( iData.getValue( md.getColumnName(0) ), DataType.STRING_TYPE =
)=20
=
);<BR> &=
nbsp; =20
=
}<BR> &n=
bsp; =20
catch ( Exception e=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
value =3D=20
=
null;<BR> &nbs=
p; &nbs p;=20
}</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
=
size=3D2> &nbs=
p; &nbs p;=20
if ( value !=3D null=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
buf.append( value=20
=
);<BR> &=
nbsp; =20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
for ( int i =3D 1; i < md.getColumnCount(); i++=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
buf.append( ',' );=20
=
//$NON-NLS-1$<BR> &n=
bsp; &n bsp; =20
=
<BR> &nb=
sp; &nb sp; =20
=
try<BR> =
=20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
value =3D cvsConvertor( ( String )=20
=
DataTypeUtil<BR> &nb=
sp; &nb sp; &nb s=
p; &nbs p; =20
.convert( iData.getValue( md.getColumnName(i) ), DataType.STRING_TYPE =
)=20
=
);<BR> &=
nbsp; & nbsp; =20
=
}<BR> &n=
bsp; &n bsp; =20
catch ( Exception e=20
=
)<BR> &n=
bsp; &n bsp; =20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
value =3D=20
=
null;<BR> &nbs=
p; &nbs p; =20
=
}<BR> &n=
bsp; &n bsp; =20
=
<BR> &nb=
sp; &nb sp; =20
if ( value !=3D null=20
=
)<BR> &n=
bsp; &n bsp; =20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
buf.append( value=20
=
);<BR> &=
nbsp; & nbsp; =20
=
}<BR> &n=
bsp; =20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
=
buf.append("\n");<BR> &nbs=
p; &nbs p; =20
=
<BR> &nb=
sp; =20
}<BR> =20
}<BR> =
}<BR> =20
<BR> }<BR> catch(Exception=20
e)<BR> {<BR> =20
System.out.println("Exception extracting report data: " +=20
e);<BR> =
}<BR> =20
<BR> resultData =3D buf.toString( =
);<BR> =20
buf.delete( 0, buf.length( ) );<BR> return=20
resultData;<BR> <BR> =20
}</FONT></DIV></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0063_01C653D2.E2A50160--
|
|
|
Re: DataExtractionTask sometimes returns duplicate records [message #149646 is a reply to message #149605] |
Thu, 30 March 2006 12:07   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0010_01C653D9.5D323D20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Jason,
Thank you for the response. Sorry, it does turn out to be a problem =
with my result set. I forgot that the HTML version is doing special =
formatting of the data so duplicate records are not shown.
"Jason Weathersby" <jweathersby@actuate.com> wrote in message =
news:e0h0gl$sr6$1@utils.eclipse.org...
Does this happen with every result set? If not can you verify the =
data?
Jason
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0f4up$cf$1@utils.eclipse.org...
I have the following method (which I copied from the =
ReportEngineService class and then customized) which runs and formats a =
report for CSV format. Most of the time it works fine, but occasionally =
I have noticed that it returns duplicate records. Any idea why this is =
happening? A test of this code returns the following results (Note: the =
last row is a duplicate):
Department,Hours Available,Total Assigned,Assignment Expired,Taken =
by Assigned,Taken by Other,Agent Exited,Customer Exited
assignmenttester,0.0,0.0,0.0,0.0,0.0,0.0
Bogus Department,0.0,0.0,0.0,0.0,0.0,0.0
Bogus DPT,0.0,0.0,0.0,0.0,0.0,0.0
boo,0.0,0.0,0.0,0.0,0.0,0.0
Buenos Dias DayCare,0.0,0.0,0.0,0.0,0.0,0.0
CG Image Test,0.0,0.0,0.0,0.0,0.0,0.0
CG Image Test 2,0.0,0.0,0.0,0.0,0.0,0.0
Chinese ?? (Simplified),0.0,0.0,0.0,0.0,0.0,0.0
Danish,0.0,0.0,0.0,0.0,0.0,0.0
Default,5.0,2.0,3.0,0.0,0.0,0.0
Default,5.0,2.0,3.0,0.0,0.0,0.0
public String getCSVReport(String resultSet, String[] =
columnHeaders, Map params)
{
IExtractionResults results =3D null;
IDataIterator iData =3D null;
String resultData =3D "";
StringBuffer buf =3D new StringBuffer( );
try
{
IRunTask runTask =3D m_birtEngine.getRunTask(m_report);
runTask.setParameterValues(params);
runTask.run(BIRT_REPORTS_FOLDER + m_reportName + =
REPORT_DOC_EXT);
IReportDocument doc =3D =
m_birtEngine.getReportDocument(BIRT_REPORTS_FOLDER + m_reportName + =
REPORT_DOC_EXT);
=20
IDataExtractionTask task =3D =
m_birtEngine.getDataExtractionTask(doc);
=20
task.selectResultSet(resultSet);
task.setLocale(Locale.ENGLISH);
results =3D task.extract();
=20
if ( columnHeaders.length !=3D 0 && results !=3D null )
{
iData =3D results.nextResultIterator( );
IResultMetaData md =3D iData.getResultMetaData();
=20
if ( iData !=3D null )
{
buf.append(columnHeaders[0]);
=20
for ( int i =3D 1; i < columnHeaders.length; i++ )
{
buf.append( ',' ); //$NON-NLS-1$
buf.append(columnHeaders[i]);
}
=20
buf.append("\n");
// Data
while ( iData.next( ) )
{
String value =3D null;
=20
try
{
value =3D cvsConvertor( ( String ) =
DataTypeUtil
.convert( iData.getValue( =
md.getColumnName(0) ), DataType.STRING_TYPE ) );
}
catch ( Exception e )
{
value =3D null;
}
if ( value !=3D null )
{
buf.append( value );
}
=20
for ( int i =3D 1; i < md.getColumnCount(); i++ )
{
buf.append( ',' ); //$NON-NLS-1$
=20
try
{
value =3D cvsConvertor( ( String ) =
DataTypeUtil
.convert( iData.getValue( =
md.getColumnName(i) ), DataType.STRING_TYPE ) );
}
catch ( Exception e )
{
value =3D null;
}
=20
if ( value !=3D null )
{
buf.append( value );
}
}
=20
buf.append("\n");
=20
}
}
}
=20
}
catch(Exception e)
{
System.out.println("Exception extracting report data: " + e);
}
=20
resultData =3D buf.toString( );
buf.delete( 0, buf.length( ) );
return resultData;
=20
}
------=_NextPart_000_0010_01C653D9.5D323D20
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2802" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Jason,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thank you for the response. =
Sorry, it does=20
turn out to be a problem with my result set. I forgot that the =
HTML=20
version is doing special formatting of the data so duplicate records are =
not=20
shown.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Jason Weathersby" <<A=20
=
href=3D"mailto:jweathersby@actuate.com">jweathersby@actuate.com</A>> =
wrote in=20
message <A=20
=
href=3D"news:e0h0gl$sr6$1@utils.eclipse.org">news:e0h0gl$sr6$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Does this happen with every result =
set? If=20
not can you verify the data?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Jason</FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> wrote =
in message=20
<A=20
=
href=3D"news:e0f4up$cf$1@utils.eclipse.org">news:e0f4up$cf$1@utils.eclips=
e.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>I have the following method (which =
I copied=20
from the ReportEngineService class and then customized) which runs =
and=20
formats a report for CSV format. Most of the time it works =
fine, but=20
occasionally I have noticed that it returns duplicate records. =
Any=20
idea why this is happening? A test of this code returns the =
following=20
results (Note: the last row is a duplicate):</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>
<P>Department,Hours Available,Total Assigned,Assignment =
Expired,Taken by=20
Assigned,Taken by Other,Agent Exited,Customer Exited</P>
<P>assignmenttester,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Bogus Department,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Bogus DPT,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>boo,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Buenos Dias DayCare,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>CG Image Test,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>CG Image Test 2,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Chinese ?? (Simplified),0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Danish,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Default,5.0,2.0,3.0,0.0,0.0,0.0</P>
<P>Default,5.0,2.0,3.0,0.0,0.0,0.0</P></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> <FONT face=3D"Times New =
Roman">public=20
String getCSVReport(String resultSet, String[] columnHeaders, Map=20
params)<BR> {<BR> IExtractionResults results =
=3D=20
null;<BR> IDataIterator iData =3D=20
null;<BR> String resultData =3D =
"";<BR> =20
StringBuffer buf =3D new StringBuffer( );</FONT></FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2> try<BR> =20
{<BR> IRunTask runTask =3D=20
m_birtEngine.getRunTask(m_report);<BR> =
=
runTask.setParameterValues(params);<BR> =20
runTask.run(BIRT_REPORTS_FOLDER + m_reportName +=20
REPORT_DOC_EXT);<BR> IReportDocument =
doc =3D=20
m_birtEngine.getReportDocument(BIRT_REPORTS_FOLDER + m_reportName +=20
REPORT_DOC_EXT);<BR> <BR> =20
IDataExtractionTask task =3D=20
=
m_birtEngine.getDataExtractionTask(doc);<BR>  =
;=20
<BR> =20
task.selectResultSet(resultSet);<BR> =20
task.setLocale(Locale.ENGLISH);<BR> =
results =3D=20
task.extract();<BR> =20
<BR> if ( columnHeaders.length !=3D 0 =
&&=20
results !=3D null )<BR> =20
{<BR> iData =3D=20
results.nextResultIterator( =
);<BR> =20
IResultMetaData md =3D=20
=
iData.getResultMetaData();<BR> =
<BR> if ( iData !=3D null=20
)<BR> =20
=
{<BR> =20
=
buf.append(columnHeaders[0]);<BR> &nbs=
p; &nbs p;=20
=
<BR> &nb=
sp; =20
for ( int i =3D 1; i < columnHeaders.length; i++=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; =20
buf.append( ',' );=20
=
//$NON-NLS-1$<BR> &n=
bsp; &n bsp; =20
=
buf.append(columnHeaders[i]);<BR> &nbs=
p; &nbs p;=20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
buf.append("\n");</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
=
size=3D2> &nbs=
p; =20
//=20
=
Data<BR>  =
; =20
while ( iData.next( )=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; =20
String value =3D=20
=
null;<BR> &nbs=
p; &nbs p;=20
=
<BR> &nb=
sp; =20
=
try<BR> =
=20
=
{<BR> &n=
bsp; &n bsp; =20
value =3D cvsConvertor( ( String )=20
=
DataTypeUtil<BR> &nb=
sp; &nb sp; &nb s=
p; &nbs p; =20
.convert( iData.getValue( md.getColumnName(0) ), =
DataType.STRING_TYPE )=20
=
);<BR> &=
nbsp; =20
=
}<BR> &n=
bsp; =20
catch ( Exception e=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
value =3D=20
=
null;<BR> &nbs=
p; &nbs p;=20
}</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
=
size=3D2> &nbs=
p; &nbs p;=20
if ( value !=3D null=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
buf.append( value=20
=
);<BR> &=
nbsp; =20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
for ( int i =3D 1; i < md.getColumnCount(); i++=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
buf.append( ',' );=20
=
//$NON-NLS-1$<BR> &n=
bsp; &n bsp; =20
=
<BR> &nb=
sp; &nb sp; =20
=
try<BR> =
=20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
value =3D cvsConvertor( ( String )=20
=
DataTypeUtil<BR> &nb=
sp; &nb sp; &nb s=
p; &nbs p; =20
.convert( iData.getValue( md.getColumnName(i) ), =
DataType.STRING_TYPE )=20
=
);<BR> &=
nbsp; & nbsp; =20
=
}<BR> &n=
bsp; &n bsp; =20
catch ( Exception e=20
=
)<BR> &n=
bsp; &n bsp; =20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
value =3D=20
=
null;<BR> &nbs=
p; &nbs p; =20
=
}<BR> &n=
bsp; &n bsp; =20
=
<BR> &nb=
sp; &nb sp; =20
if ( value !=3D null=20
=
)<BR> &n=
bsp; &n bsp; =20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
buf.append( value=20
=
);<BR> &=
nbsp; & nbsp; =20
=
}<BR> &n=
bsp; =20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
=
buf.append("\n");<BR> &nbs=
p; &nbs p; =20
=
<BR> &nb=
sp; =20
}<BR> =20
}<BR> =
}<BR> =20
<BR> }<BR> catch(Exception=20
e)<BR> {<BR> =20
System.out.println("Exception extracting report data: " +=20
e);<BR> =
}<BR> =20
<BR> resultData =3D buf.toString( =
);<BR> =20
buf.delete( 0, buf.length( ) );<BR> return=20
resultData;<BR> <BR> =20
}</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0010_01C653D9.5D323D20--
|
|
|
Re: DataExtractionTask sometimes returns duplicate records [message #149664 is a reply to message #149646] |
Thu, 30 March 2006 12:32   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_001B_01C653DC.CE77B520
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Jason,
The reason this issue is coming up is because the report is grouping on =
my Department Name, and then aggregating the data to only show one =
record for each unique Department. Is there a way around this for the =
CSV report? Or a way to access grouping information from the API?
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0h38f$l86$1@utils.eclipse.org...
Jason,
Thank you for the response. Sorry, it does turn out to be a problem =
with my result set. I forgot that the HTML version is doing special =
formatting of the data so duplicate records are not shown.
"Jason Weathersby" <jweathersby@actuate.com> wrote in message =
news:e0h0gl$sr6$1@utils.eclipse.org...
Does this happen with every result set? If not can you verify the =
data?
Jason
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0f4up$cf$1@utils.eclipse.org...
I have the following method (which I copied from the =
ReportEngineService class and then customized) which runs and formats a =
report for CSV format. Most of the time it works fine, but occasionally =
I have noticed that it returns duplicate records. Any idea why this is =
happening? A test of this code returns the following results (Note: the =
last row is a duplicate):
Department,Hours Available,Total Assigned,Assignment Expired,Taken =
by Assigned,Taken by Other,Agent Exited,Customer Exited
assignmenttester,0.0,0.0,0.0,0.0,0.0,0.0
Bogus Department,0.0,0.0,0.0,0.0,0.0,0.0
Bogus DPT,0.0,0.0,0.0,0.0,0.0,0.0
boo,0.0,0.0,0.0,0.0,0.0,0.0
Buenos Dias DayCare,0.0,0.0,0.0,0.0,0.0,0.0
CG Image Test,0.0,0.0,0.0,0.0,0.0,0.0
CG Image Test 2,0.0,0.0,0.0,0.0,0.0,0.0
Chinese ?? (Simplified),0.0,0.0,0.0,0.0,0.0,0.0
Danish,0.0,0.0,0.0,0.0,0.0,0.0
Default,5.0,2.0,3.0,0.0,0.0,0.0
Default,5.0,2.0,3.0,0.0,0.0,0.0
public String getCSVReport(String resultSet, String[] =
columnHeaders, Map params)
{
IExtractionResults results =3D null;
IDataIterator iData =3D null;
String resultData =3D "";
StringBuffer buf =3D new StringBuffer( );
try
{
IRunTask runTask =3D m_birtEngine.getRunTask(m_report);
runTask.setParameterValues(params);
runTask.run(BIRT_REPORTS_FOLDER + m_reportName + =
REPORT_DOC_EXT);
IReportDocument doc =3D =
m_birtEngine.getReportDocument(BIRT_REPORTS_FOLDER + m_reportName + =
REPORT_DOC_EXT);
=20
IDataExtractionTask task =3D =
m_birtEngine.getDataExtractionTask(doc);
=20
task.selectResultSet(resultSet);
task.setLocale(Locale.ENGLISH);
results =3D task.extract();
=20
if ( columnHeaders.length !=3D 0 && results !=3D null )
{
iData =3D results.nextResultIterator( );
IResultMetaData md =3D iData.getResultMetaData();
=20
if ( iData !=3D null )
{
buf.append(columnHeaders[0]);
=20
for ( int i =3D 1; i < columnHeaders.length; i++ )
{
buf.append( ',' ); //$NON-NLS-1$
buf.append(columnHeaders[i]);
}
=20
buf.append("\n");
// Data
while ( iData.next( ) )
{
String value =3D null;
=20
try
{
value =3D cvsConvertor( ( String ) =
DataTypeUtil
.convert( iData.getValue( =
md.getColumnName(0) ), DataType.STRING_TYPE ) );
}
catch ( Exception e )
{
value =3D null;
}
if ( value !=3D null )
{
buf.append( value );
}
=20
for ( int i =3D 1; i < md.getColumnCount(); i++ =
)
{
buf.append( ',' ); //$NON-NLS-1$
=20
try
{
value =3D cvsConvertor( ( String ) =
DataTypeUtil
.convert( iData.getValue( =
md.getColumnName(i) ), DataType.STRING_TYPE ) );
}
catch ( Exception e )
{
value =3D null;
}
=20
if ( value !=3D null )
{
buf.append( value );
}
}
=20
buf.append("\n");
=20
}
}
}
=20
}
catch(Exception e)
{
System.out.println("Exception extracting report data: " + =
e);
}
=20
resultData =3D buf.toString( );
buf.delete( 0, buf.length( ) );
return resultData;
=20
}
------=_NextPart_000_001B_01C653DC.CE77B520
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2802" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Jason,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The reason this issue is =
coming up is=20
because the report is grouping on my Department Name, and then =
aggregating the=20
data to only show one record for each unique Department. Is there =
a way=20
around this for the CSV report? Or a way to access grouping =
information=20
from the API?</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> wrote in =
message=20
<A=20
=
href=3D"news:e0h38f$l86$1@utils.eclipse.org">news:e0h38f$l86$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Jason,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thank you for the response. =
Sorry, it does=20
turn out to be a problem with my result set. I forgot that the =
HTML=20
version is doing special formatting of the data so duplicate records =
are not=20
shown.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Jason Weathersby" <<A=20
=
href=3D"mailto:jweathersby@actuate.com">jweathersby@actuate.com</A>> =
wrote=20
in message <A=20
=
href=3D"news:e0h0gl$sr6$1@utils.eclipse.org">news:e0h0gl$sr6$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Does this happen with every result =
set? =20
If not can you verify the data?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Jason</FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> =
wrote in=20
message <A=20
=
href=3D"news:e0f4up$cf$1@utils.eclipse.org">news:e0f4up$cf$1@utils.eclips=
e.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>I have the following method =
(which I copied=20
from the ReportEngineService class and then customized) which runs =
and=20
formats a report for CSV format. Most of the time it works =
fine, but=20
occasionally I have noticed that it returns duplicate =
records. Any=20
idea why this is happening? A test of this code returns the=20
following results (Note: the last row is a =
duplicate):</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>
<P>Department,Hours Available,Total Assigned,Assignment =
Expired,Taken by=20
Assigned,Taken by Other,Agent Exited,Customer Exited</P>
<P>assignmenttester,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Bogus Department,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Bogus DPT,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>boo,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Buenos Dias DayCare,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>CG Image Test,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>CG Image Test 2,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Chinese ?? (Simplified),0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Danish,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Default,5.0,2.0,3.0,0.0,0.0,0.0</P>
<P>Default,5.0,2.0,3.0,0.0,0.0,0.0</P></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> <FONT face=3D"Times New =
Roman">public=20
String getCSVReport(String resultSet, String[] columnHeaders, Map=20
params)<BR> {<BR> IExtractionResults =
results =3D=20
null;<BR> IDataIterator iData =3D=20
null;<BR> String resultData =3D =
"";<BR> =20
StringBuffer buf =3D new StringBuffer( );</FONT></FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2> try<BR> =20
{<BR> IRunTask runTask =3D=20
=
m_birtEngine.getRunTask(m_report);<BR> =20
=
runTask.setParameterValues(params);<BR> =20
runTask.run(BIRT_REPORTS_FOLDER + m_reportName +=20
REPORT_DOC_EXT);<BR> IReportDocument =
doc =3D=20
m_birtEngine.getReportDocument(BIRT_REPORTS_FOLDER + m_reportName =
+=20
REPORT_DOC_EXT);<BR> <BR> =20
IDataExtractionTask task =3D=20
=
m_birtEngine.getDataExtractionTask(doc);<BR>  =
;=20
<BR> =20
task.selectResultSet(resultSet);<BR> =
task.setLocale(Locale.ENGLISH);<BR> =
results=20
=3D task.extract();<BR> =20
<BR> if ( columnHeaders.length !=3D =
0=20
&& results !=3D null )<BR> =20
{<BR> iData =3D=20
results.nextResultIterator(=20
);<BR> IResultMetaData =
md =3D=20
=
iData.getResultMetaData();<BR> =
<BR> if ( iData !=3D =
null=20
)<BR> =20
=
{<BR> =20
=
buf.append(columnHeaders[0]);<BR> &nbs=
p; &nbs p;=20
=
<BR> &nb=
sp; =20
for ( int i =3D 1; i < columnHeaders.length; i++=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; =20
buf.append( ',' );=20
=
//$NON-NLS-1$<BR> &n=
bsp; &n bsp; =20
=
buf.append(columnHeaders[i]);<BR> &nbs=
p; &nbs p;=20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
buf.append("\n");</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
=
size=3D2> &nbs=
p; =20
//=20
=
Data<BR>  =
; =20
while ( iData.next( )=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; =20
String value =3D=20
=
null;<BR> &nbs=
p; &nbs p;=20
=
<BR> &nb=
sp; =20
=
try<BR> =
=20
=
{<BR> &n=
bsp; &n bsp; =20
value =3D cvsConvertor( ( String )=20
=
DataTypeUtil<BR> &nb=
sp; &nb sp; &nb s=
p; &nbs p; =20
.convert( iData.getValue( md.getColumnName(0) ), =
DataType.STRING_TYPE )=20
=
);<BR> &=
nbsp; =20
=
}<BR> &n=
bsp; =20
catch ( Exception e=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
value =3D=20
=
null;<BR> &nbs=
p; &nbs p;=20
}</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
=
size=3D2> &nbs=
p; &nbs p;=20
if ( value !=3D null=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
buf.append( value=20
=
);<BR> &=
nbsp; =20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
for ( int i =3D 1; i < md.getColumnCount(); i++=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
buf.append( ',' );=20
=
//$NON-NLS-1$<BR> &n=
bsp; &n bsp; =20
=
<BR> &nb=
sp; &nb sp; =20
=
try<BR> =
=20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
value =3D cvsConvertor( ( String )=20
=
DataTypeUtil<BR> &nb=
sp; &nb sp; &nb s=
p; &nbs p; =20
.convert( iData.getValue( md.getColumnName(i) ), =
DataType.STRING_TYPE )=20
=
);<BR> &=
nbsp; & nbsp; =20
=
}<BR> &n=
bsp; &n bsp; =20
catch ( Exception e=20
=
)<BR> &n=
bsp; &n bsp; =20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
value =3D=20
=
null;<BR> &nbs=
p; &nbs p; =20
=
}<BR> &n=
bsp; &n bsp; =20
=
<BR> &nb=
sp; &nb sp; =20
if ( value !=3D null=20
=
)<BR> &n=
bsp; &n bsp; =20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
buf.append( value=20
=
);<BR> &=
nbsp; & nbsp; =20
=
}<BR> &n=
bsp; =20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
=
buf.append("\n");<BR> &nbs=
p; &nbs p; =20
=
<BR> &nb=
sp; =20
}<BR> =20
}<BR> =
}<BR> =20
<BR> }<BR> catch(Exception=20
e)<BR> {<BR> =20
System.out.println("Exception extracting report data: " +=20
e);<BR> =
}<BR> =20
<BR> resultData =3D buf.toString( =
);<BR> =20
buf.delete( 0, buf.length( ) );<BR> return=20
resultData;<BR> <BR> =20
}</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY ></HTML>
------=_NextPart_000_001B_01C653DC.CE77B520--
|
|
|
Re: DataExtractionTask sometimes returns duplicate records [message #149715 is a reply to message #149664] |
Thu, 30 March 2006 11:19   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0018_01C653EB.DFE89720
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Melissa,
Are you doing the aggregation in the report or the query?
Also when you run this report in the viewer and use the export does it =
do the same thing?
Jason
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0h4mm$ut6$1@utils.eclipse.org...
Jason,
The reason this issue is coming up is because the report is grouping =
on my Department Name, and then aggregating the data to only show one =
record for each unique Department. Is there a way around this for the =
CSV report? Or a way to access grouping information from the API?
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0h38f$l86$1@utils.eclipse.org...
Jason,
Thank you for the response. Sorry, it does turn out to be a problem =
with my result set. I forgot that the HTML version is doing special =
formatting of the data so duplicate records are not shown.
"Jason Weathersby" <jweathersby@actuate.com> wrote in message =
news:e0h0gl$sr6$1@utils.eclipse.org...
Does this happen with every result set? If not can you verify the =
data?
Jason
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0f4up$cf$1@utils.eclipse.org...
I have the following method (which I copied from the =
ReportEngineService class and then customized) which runs and formats a =
report for CSV format. Most of the time it works fine, but occasionally =
I have noticed that it returns duplicate records. Any idea why this is =
happening? A test of this code returns the following results (Note: the =
last row is a duplicate):
Department,Hours Available,Total Assigned,Assignment =
Expired,Taken by Assigned,Taken by Other,Agent Exited,Customer Exited
assignmenttester,0.0,0.0,0.0,0.0,0.0,0.0
Bogus Department,0.0,0.0,0.0,0.0,0.0,0.0
Bogus DPT,0.0,0.0,0.0,0.0,0.0,0.0
boo,0.0,0.0,0.0,0.0,0.0,0.0
Buenos Dias DayCare,0.0,0.0,0.0,0.0,0.0,0.0
CG Image Test,0.0,0.0,0.0,0.0,0.0,0.0
CG Image Test 2,0.0,0.0,0.0,0.0,0.0,0.0
Chinese ?? (Simplified),0.0,0.0,0.0,0.0,0.0,0.0
Danish,0.0,0.0,0.0,0.0,0.0,0.0
Default,5.0,2.0,3.0,0.0,0.0,0.0
Default,5.0,2.0,3.0,0.0,0.0,0.0
public String getCSVReport(String resultSet, String[] =
columnHeaders, Map params)
{
IExtractionResults results =3D null;
IDataIterator iData =3D null;
String resultData =3D "";
StringBuffer buf =3D new StringBuffer( );
try
{
IRunTask runTask =3D m_birtEngine.getRunTask(m_report);
runTask.setParameterValues(params);
runTask.run(BIRT_REPORTS_FOLDER + m_reportName + =
REPORT_DOC_EXT);
IReportDocument doc =3D =
m_birtEngine.getReportDocument(BIRT_REPORTS_FOLDER + m_reportName + =
REPORT_DOC_EXT);
=20
IDataExtractionTask task =3D =
m_birtEngine.getDataExtractionTask(doc);
=20
task.selectResultSet(resultSet);
task.setLocale(Locale.ENGLISH);
results =3D task.extract();
=20
if ( columnHeaders.length !=3D 0 && results !=3D null )
{
iData =3D results.nextResultIterator( );
IResultMetaData md =3D iData.getResultMetaData();
=20
if ( iData !=3D null )
{
buf.append(columnHeaders[0]);
=20
for ( int i =3D 1; i < columnHeaders.length; i++ )
{
buf.append( ',' ); //$NON-NLS-1$
buf.append(columnHeaders[i]);
}
=20
buf.append("\n");
// Data
while ( iData.next( ) )
{
String value =3D null;
=20
try
{
value =3D cvsConvertor( ( String ) =
DataTypeUtil
.convert( iData.getValue( =
md.getColumnName(0) ), DataType.STRING_TYPE ) );
}
catch ( Exception e )
{
value =3D null;
}
if ( value !=3D null )
{
buf.append( value );
}
=20
for ( int i =3D 1; i < md.getColumnCount(); =
i++ )
{
buf.append( ',' ); //$NON-NLS-1$
=20
try
{
value =3D cvsConvertor( ( String ) =
DataTypeUtil
.convert( iData.getValue( =
md.getColumnName(i) ), DataType.STRING_TYPE ) );
}
catch ( Exception e )
{
value =3D null;
}
=20
if ( value !=3D null )
{
buf.append( value );
}
}
=20
buf.append("\n");
=20
}
}
}
=20
}
catch(Exception e)
{
System.out.println("Exception extracting report data: " + =
e);
}
=20
resultData =3D buf.toString( );
buf.delete( 0, buf.length( ) );
return resultData;
=20
}
------=_NextPart_000_0018_01C653EB.DFE89720
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2769" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Melissa,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Are you doing the aggregation in the =
report or the=20
query?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Also when you run this report in the =
viewer and use=20
the export does it do the same thing?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Jason</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> wrote in =
message=20
<A=20
=
href=3D"news:e0h4mm$ut6$1@utils.eclipse.org">news:e0h4mm$ut6$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Jason,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The reason this issue is =
coming up is=20
because the report is grouping on my Department Name, and then =
aggregating the=20
data to only show one record for each unique Department. Is =
there a way=20
around this for the CSV report? Or a way to access grouping =
information=20
from the API?</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> wrote =
in message=20
<A=20
=
href=3D"news:e0h38f$l86$1@utils.eclipse.org">news:e0h38f$l86$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Jason,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thank you for the response. =
Sorry, it=20
does turn out to be a problem with my result set. I forgot =
that the=20
HTML version is doing special formatting of the data so duplicate =
records=20
are not shown.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Jason Weathersby" <<A=20
=
href=3D"mailto:jweathersby@actuate.com">jweathersby@actuate.com</A>>=20
wrote in message <A=20
=
href=3D"news:e0h0gl$sr6$1@utils.eclipse.org">news:e0h0gl$sr6$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Does this happen with every =
result set? =20
If not can you verify the data?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Jason</FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> =
wrote in=20
message <A=20
=
href=3D"news:e0f4up$cf$1@utils.eclipse.org">news:e0f4up$cf$1@utils.eclips=
e.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>I have the following method =
(which I copied=20
from the ReportEngineService class and then customized) which =
runs and=20
formats a report for CSV format. Most of the time it works =
fine,=20
but occasionally I have noticed that it returns duplicate =
records. =20
Any idea why this is happening? A test of this code =
returns the=20
following results (Note: the last row is a =
duplicate):</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>
<P>Department,Hours Available,Total Assigned,Assignment =
Expired,Taken by=20
Assigned,Taken by Other,Agent Exited,Customer Exited</P>
<P>assignmenttester,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Bogus Department,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Bogus DPT,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>boo,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Buenos Dias DayCare,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>CG Image Test,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>CG Image Test 2,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Chinese ?? (Simplified),0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Danish,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Default,5.0,2.0,3.0,0.0,0.0,0.0</P>
<P>Default,5.0,2.0,3.0,0.0,0.0,0.0</P></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> <FONT face=3D"Times New =
Roman">public=20
String getCSVReport(String resultSet, String[] columnHeaders, =
Map=20
params)<BR> {<BR> IExtractionResults =
results =3D=20
null;<BR> IDataIterator iData =3D=20
null;<BR> String resultData =3D=20
"";<BR> StringBuffer buf =3D new StringBuffer( =
);</FONT></FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2> try<BR> =
{<BR> IRunTask runTask =3D=20
=
m_birtEngine.getRunTask(m_report);<BR> =20
=
runTask.setParameterValues(params);<BR> =20
runTask.run(BIRT_REPORTS_FOLDER + m_reportName +=20
REPORT_DOC_EXT);<BR> =
IReportDocument doc =3D=20
m_birtEngine.getReportDocument(BIRT_REPORTS_FOLDER + =
m_reportName +=20
REPORT_DOC_EXT);<BR> <BR> =20
IDataExtractionTask task =3D=20
=
m_birtEngine.getDataExtractionTask(doc);<BR>  =
;=20
<BR> =20
=
task.selectResultSet(resultSet);<BR> =20
=
task.setLocale(Locale.ENGLISH);<BR> =20
results =3D task.extract();<BR> =20
<BR> if ( columnHeaders.length =
!=3D 0=20
&& results !=3D null )<BR> =
{<BR> iData =3D=20
results.nextResultIterator(=20
);<BR> IResultMetaData =
md =3D=20
=
iData.getResultMetaData();<BR> =
<BR> if ( iData !=3D =
null=20
)<BR> =20
=
{<BR> =20
=
buf.append(columnHeaders[0]);<BR> &nbs=
p; &nbs p;=20
=
<BR> &nb=
sp; =20
for ( int i =3D 1; i < columnHeaders.length; i++=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; =20
buf.append( ',' );=20
=
//$NON-NLS-1$<BR> &n=
bsp; &n bsp; =20
=
buf.append(columnHeaders[i]);<BR> &nbs=
p; &nbs p;=20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
buf.append("\n");</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
=
size=3D2> &nbs=
p; =20
//=20
=
Data<BR>  =
; =20
while ( iData.next( )=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; =20
String value =3D=20
=
null;<BR> &nbs=
p; &nbs p;=20
=
<BR> &nb=
sp; =20
=
try<BR> =
=20
=
{<BR> &n=
bsp; &n bsp; =20
value =3D cvsConvertor( ( String )=20
=
DataTypeUtil<BR> &nb=
sp; &nb sp; &nb s=
p; &nbs p; =20
.convert( iData.getValue( md.getColumnName(0) ), =
DataType.STRING_TYPE )=20
=
);<BR> &=
nbsp; =20
=
}<BR> &n=
bsp; =20
catch ( Exception e=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
value =3D=20
=
null;<BR> &nbs=
p; &nbs p;=20
}</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
=
size=3D2> &nbs=
p; &nbs p;=20
if ( value !=3D null=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
buf.append( value=20
=
);<BR> &=
nbsp; =20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
for ( int i =3D 1; i < md.getColumnCount(); i++=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
buf.append( ',' );=20
=
//$NON-NLS-1$<BR> &n=
bsp; &n bsp; =20
=
<BR> &nb=
sp; &nb sp; =20
=
try<BR> =
=20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
value =3D cvsConvertor( ( String )=20
=
DataTypeUtil<BR> &nb=
sp; &nb sp; &nb s=
p; &nbs p; =20
.convert( iData.getValue( md.getColumnName(i) ), =
DataType.STRING_TYPE )=20
=
);<BR> &=
nbsp; & nbsp; =20
=
}<BR> &n=
bsp; &n bsp; =20
catch ( Exception e=20
=
)<BR> &n=
bsp; &n bsp; =20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
value =3D=20
=
null;<BR> &nbs=
p; &nbs p; =20
=
}<BR> &n=
bsp; &n bsp; =20
=
<BR> &nb=
sp; &nb sp; =20
if ( value !=3D null=20
=
)<BR> &n=
bsp; &n bsp; =20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
buf.append( value=20
=
);<BR> &=
nbsp; & nbsp; =20
=
}<BR> &n=
bsp; =20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
=
buf.append("\n");<BR> &nbs=
p; &nbs p; =20
=
<BR> &nb=
sp; =20
}<BR> =20
}<BR> =
}<BR> =20
<BR> }<BR> catch(Exception=20
e)<BR> {<BR> =20
System.out.println("Exception extracting report data: " +=20
e);<BR> =20
}<BR> =
<BR> =20
resultData =3D buf.toString( );<BR> =
buf.delete( 0,=20
buf.length( ) );<BR> return=20
resultData;<BR> <BR> =20
=
}</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE ></BODY>=
</HTML>
------=_NextPart_000_0018_01C653EB.DFE89720--
|
|
|
Re: DataExtractionTask sometimes returns duplicate records [message #149765 is a reply to message #149715] |
Thu, 30 March 2006 17:20   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0085_01C65405.0E3A76C0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Yes, the same thing happens when I run the report in the Viewer and use =
the Export functionality.
I am doing the aggregation I was talking about within the report. My =
query returns these results:
STATUSCODE DEPARTMENTID DEPARTMENT COUNT
100 -2 Default =
2
101 -2 Default =
3
My report then has the following table cell entries in the Group Header =
section of my table:
Total.sum(row["COUNT"], row["STATUSCODE"] =3D=3D 100)
Total.sum(row["COUNT"], row["STATUSCODE"] =3D=3D 101)
"Jason Weathersby" <jweathersby@actuate.com> wrote in message =
news:e0hb02$6q6$1@utils.eclipse.org...
Melissa,
Are you doing the aggregation in the report or the query?
Also when you run this report in the viewer and use the export does it =
do the same thing?
Jason
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0h4mm$ut6$1@utils.eclipse.org...
Jason,
The reason this issue is coming up is because the report is grouping =
on my Department Name, and then aggregating the data to only show one =
record for each unique Department. Is there a way around this for the =
CSV report? Or a way to access grouping information from the API?
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0h38f$l86$1@utils.eclipse.org...
Jason,
Thank you for the response. Sorry, it does turn out to be a =
problem with my result set. I forgot that the HTML version is doing =
special formatting of the data so duplicate records are not shown.
"Jason Weathersby" <jweathersby@actuate.com> wrote in message =
news:e0h0gl$sr6$1@utils.eclipse.org...
Does this happen with every result set? If not can you verify =
the data?
Jason
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0f4up$cf$1@utils.eclipse.org...
I have the following method (which I copied from the =
ReportEngineService class and then customized) which runs and formats a =
report for CSV format. Most of the time it works fine, but occasionally =
I have noticed that it returns duplicate records. Any idea why this is =
happening? A test of this code returns the following results (Note: the =
last row is a duplicate):
Department,Hours Available,Total Assigned,Assignment =
Expired,Taken by Assigned,Taken by Other,Agent Exited,Customer Exited
assignmenttester,0.0,0.0,0.0,0.0,0.0,0.0
Bogus Department,0.0,0.0,0.0,0.0,0.0,0.0
Bogus DPT,0.0,0.0,0.0,0.0,0.0,0.0
boo,0.0,0.0,0.0,0.0,0.0,0.0
Buenos Dias DayCare,0.0,0.0,0.0,0.0,0.0,0.0
CG Image Test,0.0,0.0,0.0,0.0,0.0,0.0
CG Image Test 2,0.0,0.0,0.0,0.0,0.0,0.0
Chinese ?? (Simplified),0.0,0.0,0.0,0.0,0.0,0.0
Danish,0.0,0.0,0.0,0.0,0.0,0.0
Default,5.0,2.0,3.0,0.0,0.0,0.0
Default,5.0,2.0,3.0,0.0,0.0,0.0
public String getCSVReport(String resultSet, String[] =
columnHeaders, Map params)
{
IExtractionResults results =3D null;
IDataIterator iData =3D null;
String resultData =3D "";
StringBuffer buf =3D new StringBuffer( );
try
{
IRunTask runTask =3D m_birtEngine.getRunTask(m_report);
runTask.setParameterValues(params);
runTask.run(BIRT_REPORTS_FOLDER + m_reportName + =
REPORT_DOC_EXT);
IReportDocument doc =3D =
m_birtEngine.getReportDocument(BIRT_REPORTS_FOLDER + m_reportName + =
REPORT_DOC_EXT);
=20
IDataExtractionTask task =3D =
m_birtEngine.getDataExtractionTask(doc);
=20
task.selectResultSet(resultSet);
task.setLocale(Locale.ENGLISH);
results =3D task.extract();
=20
if ( columnHeaders.length !=3D 0 && results !=3D null )
{
iData =3D results.nextResultIterator( );
IResultMetaData md =3D iData.getResultMetaData();
=20
if ( iData !=3D null )
{
buf.append(columnHeaders[0]);
=20
for ( int i =3D 1; i < columnHeaders.length; i++ =
)
{
buf.append( ',' ); //$NON-NLS-1$
buf.append(columnHeaders[i]);
}
=20
buf.append("\n");
// Data
while ( iData.next( ) )
{
String value =3D null;
=20
try
{
value =3D cvsConvertor( ( String ) =
DataTypeUtil
.convert( iData.getValue( =
md.getColumnName(0) ), DataType.STRING_TYPE ) );
}
catch ( Exception e )
{
value =3D null;
}
if ( value !=3D null )
{
buf.append( value );
}
=20
for ( int i =3D 1; i < md.getColumnCount(); =
i++ )
{
buf.append( ',' ); //$NON-NLS-1$
=20
try
{
value =3D cvsConvertor( ( String ) =
DataTypeUtil
.convert( iData.getValue( =
md.getColumnName(i) ), DataType.STRING_TYPE ) );
}
catch ( Exception e )
{
value =3D null;
}
=20
if ( value !=3D null )
{
buf.append( value );
}
}
=20
buf.append("\n");
=20
}
}
}
=20
}
catch(Exception e)
{
System.out.println("Exception extracting report data: " =
+ e);
}
=20
resultData =3D buf.toString( );
buf.delete( 0, buf.length( ) );
return resultData;
=20
}
------=_NextPart_000_0085_01C65405.0E3A76C0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2802" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Yes, the same thing happens when I run =
the report=20
in the Viewer and use the Export functionality.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>I am doing the aggregation I was talking about within the =
report. My=20
query returns these results:</DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>STATUSCODE =
=20
DEPARTMENTID =
DEPARTMENT =20
COUNT</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>100 =
=20
=
=20
-2 =
=20
=
=20
Default =20
2</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>101 =
=20
=
=20
-2 =
=20
=
=20
Default =20
3</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>My report then has the following table =
cell entries=20
in the Group Header section of my table:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Total.sum(row["COUNT"], =
row["STATUSCODE"] =3D=3D=20
100)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Total.sum(row["COUNT"], =
row["STATUSCODE"] =3D=3D=20
101)</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Jason Weathersby" <<A=20
=
href=3D"mailto:jweathersby@actuate.com">jweathersby@actuate.com</A>> =
wrote in=20
message <A=20
=
href=3D"news:e0hb02$6q6$1@utils.eclipse.org">news:e0hb02$6q6$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Melissa,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Are you doing the aggregation in the =
report or=20
the query?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Also when you run this report in the =
viewer and=20
use the export does it do the same thing?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Jason</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> wrote =
in message=20
<A=20
=
href=3D"news:e0h4mm$ut6$1@utils.eclipse.org">news:e0h4mm$ut6$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Jason,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The reason this issue is =
coming up is=20
because the report is grouping on my Department Name, and then =
aggregating=20
the data to only show one record for each unique Department. =
Is there=20
a way around this for the CSV report? Or a way to access =
grouping=20
information from the API?</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> =
wrote in=20
message <A=20
=
href=3D"news:e0h38f$l86$1@utils.eclipse.org">news:e0h38f$l86$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Jason,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thank you for the response. =
Sorry, it=20
does turn out to be a problem with my result set. I forgot =
that the=20
HTML version is doing special formatting of the data so duplicate =
records=20
are not shown.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Jason Weathersby" <<A=20
=
href=3D"mailto:jweathersby@actuate.com">jweathersby@actuate.com</A>>=20
wrote in message <A=20
=
href=3D"news:e0h0gl$sr6$1@utils.eclipse.org">news:e0h0gl$sr6$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Does this happen with every =
result=20
set? If not can you verify the data?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Jason</FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: =
5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> =
wrote in=20
message <A=20
=
href=3D"news:e0f4up$cf$1@utils.eclipse.org">news:e0f4up$cf$1@utils.eclips=
e.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>I have the following method =
(which I=20
copied from the ReportEngineService class and then customized) =
which=20
runs and formats a report for CSV format. Most of the =
time it=20
works fine, but occasionally I have noticed that it returns =
duplicate=20
records. Any idea why this is happening? A test of =
this=20
code returns the following results (Note: the last row is a=20
duplicate):</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>
<P>Department,Hours Available,Total Assigned,Assignment =
Expired,Taken=20
by Assigned,Taken by Other,Agent Exited,Customer Exited</P>
<P>assignmenttester,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Bogus Department,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Bogus DPT,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>boo,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Buenos Dias DayCare,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>CG Image Test,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>CG Image Test 2,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Chinese ?? (Simplified),0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Danish,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Default,5.0,2.0,3.0,0.0,0.0,0.0</P>
<P>Default,5.0,2.0,3.0,0.0,0.0,0.0</P></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> <FONT=20
face=3D"Times New Roman">public String getCSVReport(String =
resultSet,=20
String[] columnHeaders, Map params)<BR> =
{<BR> =20
IExtractionResults results =3D null;<BR> =
IDataIterator=20
iData =3D null;<BR> String resultData =3D=20
"";<BR> StringBuffer buf =3D new =
StringBuffer(=20
);</FONT></FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2> =
try<BR> =20
{<BR> IRunTask runTask =3D=20
=
m_birtEngine.getRunTask(m_report);<BR> =20
=
runTask.setParameterValues(params);<BR> =20
runTask.run(BIRT_REPORTS_FOLDER + m_reportName +=20
REPORT_DOC_EXT);<BR> =
IReportDocument doc=20
=3D m_birtEngine.getReportDocument(BIRT_REPORTS_FOLDER + =
m_reportName +=20
REPORT_DOC_EXT);<BR> <BR> =20
IDataExtractionTask task =3D=20
=
m_birtEngine.getDataExtractionTask(doc);<BR>  =
;=20
<BR> =20
=
task.selectResultSet(resultSet);<BR> =20
=
task.setLocale(Locale.ENGLISH);<BR> =20
results =3D task.extract();<BR> =20
<BR> if ( columnHeaders.length =
!=3D 0=20
&& results !=3D null =
)<BR> =20
{<BR> iData =3D=20
results.nextResultIterator(=20
);<BR> =
IResultMetaData md =3D=20
=
iData.getResultMetaData();<BR> =
<BR> if ( iData !=3D =
null=20
)<BR> =20
=
{<BR> =20
=
buf.append(columnHeaders[0]);<BR> &nbs=
p; &nbs p;=20
=
<BR> &nb=
sp; =20
for ( int i =3D 1; i < columnHeaders.length; i++=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; =20
buf.append( ',' );=20
=
//$NON-NLS-1$<BR> &n=
bsp; &n bsp; =20
=
buf.append(columnHeaders[i]);<BR> &nbs=
p; &nbs p;=20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
buf.append("\n");</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
=
size=3D2> &nbs=
p; =20
//=20
=
Data<BR>  =
; =20
while ( iData.next( )=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; =20
String value =3D=20
=
null;<BR> &nbs=
p; &nbs p;=20
=
<BR> &nb=
sp; =20
=
try<BR> =
=20
=
{<BR> &n=
bsp; &n bsp; =20
value =3D cvsConvertor( ( String )=20
=
DataTypeUtil<BR> &nb=
sp; &nb sp; &nb s=
p; &nbs p; =20
.convert( iData.getValue( md.getColumnName(0) ), =
DataType.STRING_TYPE=20
)=20
=
);<BR> &=
nbsp; =20
=
}<BR> &n=
bsp; =20
catch ( Exception e=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
value =3D=20
=
null;<BR> &nbs=
p; &nbs p;=20
}</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
=
size=3D2> &nbs=
p; &nbs p;=20
if ( value !=3D null=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
buf.append( value=20
=
);<BR> &=
nbsp; =20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
for ( int i =3D 1; i < md.getColumnCount(); i++=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
buf.append( ',' );=20
=
//$NON-NLS-1$<BR> &n=
bsp; &n bsp; =20
=
<BR> &nb=
sp; &nb sp; =20
=
try<BR> =
=20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
value =3D cvsConvertor( ( String )=20
=
DataTypeUtil<BR> &nb=
sp; &nb sp; &nb s=
p; &nbs p; =20
.convert( iData.getValue( md.getColumnName(i) ), =
DataType.STRING_TYPE=20
)=20
=
);<BR> &=
nbsp; & nbsp; =20
=
}<BR> &n=
bsp; &n bsp; =20
catch ( Exception e=20
=
)<BR> &n=
bsp; &n bsp; =20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
value =3D=20
=
null;<BR> &nbs=
p; &nbs p; =20
=
}<BR> &n=
bsp; &n bsp; =20
=
<BR> &nb=
sp; &nb sp; =20
if ( value !=3D null=20
=
)<BR> &n=
bsp; &n bsp; =20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
buf.append( value=20
=
);<BR> &=
nbsp; & nbsp; =20
=
}<BR> &n=
bsp; =20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
=
buf.append("\n");<BR> &nbs=
p; &nbs p; =20
=
<BR> &nb=
sp; =20
}<BR> =20
}<BR> =20
}<BR> <BR> =20
}<BR> catch(Exception =
e)<BR> =20
{<BR> =
System.out.println("Exception=20
extracting report data: " + e);<BR> =20
}<BR> =
<BR> =20
resultData =3D buf.toString( );<BR> =
buf.delete( 0,=20
buf.length( ) );<BR> return=20
resultData;<BR> <BR> =20
=
}</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE ></BLOCK=
QUOTE></BODY></HTML>
------=_NextPart_000_0085_01C65405.0E3A76C0--
|
|
|
Re: DataExtractionTask sometimes returns duplicate records [message #150003 is a reply to message #149765] |
Fri, 31 March 2006 07:11   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_000B_01C65492.67A590E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Melissa,
I dont see an easy way of doing this without adding another query.
Can you log an enhancement request?
Jason
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0hlir$tj7$1@utils.eclipse.org...
Yes, the same thing happens when I run the report in the Viewer and =
use the Export functionality.
I am doing the aggregation I was talking about within the report. My =
query returns these results:
STATUSCODE DEPARTMENTID DEPARTMENT COUNT
100 -2 Default =
2
101 -2 Default =
3
My report then has the following table cell entries in the Group =
Header section of my table:
Total.sum(row["COUNT"], row["STATUSCODE"] =3D=3D 100)
Total.sum(row["COUNT"], row["STATUSCODE"] =3D=3D 101)
"Jason Weathersby" <jweathersby@actuate.com> wrote in message =
news:e0hb02$6q6$1@utils.eclipse.org...
Melissa,
Are you doing the aggregation in the report or the query?
Also when you run this report in the viewer and use the export does =
it do the same thing?
Jason
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0h4mm$ut6$1@utils.eclipse.org...
Jason,
The reason this issue is coming up is because the report is =
grouping on my Department Name, and then aggregating the data to only =
show one record for each unique Department. Is there a way around this =
for the CSV report? Or a way to access grouping information from the =
API?
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0h38f$l86$1@utils.eclipse.org...
Jason,
Thank you for the response. Sorry, it does turn out to be a =
problem with my result set. I forgot that the HTML version is doing =
special formatting of the data so duplicate records are not shown.
"Jason Weathersby" <jweathersby@actuate.com> wrote in message =
news:e0h0gl$sr6$1@utils.eclipse.org...
Does this happen with every result set? If not can you verify =
the data?
Jason
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0f4up$cf$1@utils.eclipse.org...
I have the following method (which I copied from the =
ReportEngineService class and then customized) which runs and formats a =
report for CSV format. Most of the time it works fine, but occasionally =
I have noticed that it returns duplicate records. Any idea why this is =
happening? A test of this code returns the following results (Note: the =
last row is a duplicate):
Department,Hours Available,Total Assigned,Assignment =
Expired,Taken by Assigned,Taken by Other,Agent Exited,Customer Exited
assignmenttester,0.0,0.0,0.0,0.0,0.0,0.0
Bogus Department,0.0,0.0,0.0,0.0,0.0,0.0
Bogus DPT,0.0,0.0,0.0,0.0,0.0,0.0
boo,0.0,0.0,0.0,0.0,0.0,0.0
Buenos Dias DayCare,0.0,0.0,0.0,0.0,0.0,0.0
CG Image Test,0.0,0.0,0.0,0.0,0.0,0.0
CG Image Test 2,0.0,0.0,0.0,0.0,0.0,0.0
Chinese ?? (Simplified),0.0,0.0,0.0,0.0,0.0,0.0
Danish,0.0,0.0,0.0,0.0,0.0,0.0
Default,5.0,2.0,3.0,0.0,0.0,0.0
Default,5.0,2.0,3.0,0.0,0.0,0.0
public String getCSVReport(String resultSet, String[] =
columnHeaders, Map params)
{
IExtractionResults results =3D null;
IDataIterator iData =3D null;
String resultData =3D "";
StringBuffer buf =3D new StringBuffer( );
try
{
IRunTask runTask =3D =
m_birtEngine.getRunTask(m_report);
runTask.setParameterValues(params);
runTask.run(BIRT_REPORTS_FOLDER + m_reportName + =
REPORT_DOC_EXT);
IReportDocument doc =3D =
m_birtEngine.getReportDocument(BIRT_REPORTS_FOLDER + m_reportName + =
REPORT_DOC_EXT);
=20
IDataExtractionTask task =3D =
m_birtEngine.getDataExtractionTask(doc);
=20
task.selectResultSet(resultSet);
task.setLocale(Locale.ENGLISH);
results =3D task.extract();
=20
if ( columnHeaders.length !=3D 0 && results !=3D null =
)
{
iData =3D results.nextResultIterator( );
IResultMetaData md =3D iData.getResultMetaData();
=20
if ( iData !=3D null )
{
buf.append(columnHeaders[0]);
=20
for ( int i =3D 1; i < columnHeaders.length; =
i++ )
{
buf.append( ',' ); //$NON-NLS-1$
buf.append(columnHeaders[i]);
}
=20
buf.append("\n");
// Data
while ( iData.next( ) )
{
String value =3D null;
=20
try
{
value =3D cvsConvertor( ( String ) =
DataTypeUtil
.convert( iData.getValue( =
md.getColumnName(0) ), DataType.STRING_TYPE ) );
}
catch ( Exception e )
{
value =3D null;
}
if ( value !=3D null )
{
buf.append( value );
}
=20
for ( int i =3D 1; i < =
md.getColumnCount(); i++ )
{
buf.append( ',' ); //$NON-NLS-1$
=20
try
{
value =3D cvsConvertor( ( String ) =
DataTypeUtil
.convert( iData.getValue( =
md.getColumnName(i) ), DataType.STRING_TYPE ) );
}
catch ( Exception e )
{
value =3D null;
}
=20
if ( value !=3D null )
{
buf.append( value );
}
}
=20
buf.append("\n");
=20
}
}
}
=20
}
catch(Exception e)
{
System.out.println("Exception extracting report data: =
" + e);
}
=20
resultData =3D buf.toString( );
buf.delete( 0, buf.length( ) );
return resultData;
=20
}
------=_NextPart_000_000B_01C65492.67A590E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2769" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Melissa,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>I dont see an easy way of doing this =
without adding=20
another query.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Can you log an enhancement =
request?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Jason</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> wrote in =
message=20
<A=20
=
href=3D"news:e0hlir$tj7$1@utils.eclipse.org">news:e0hlir$tj7$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Yes, the same thing happens when I =
run the report=20
in the Viewer and use the Export functionality.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>I am doing the aggregation I was talking about within the =
report. =20
My query returns these results:</DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>STATUSCODE =
=20
DEPARTMENTID =
DEPARTMENT =20
COUNT</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>100 =
=20
=
=20
-2 =
=20
=
=20
Default =20
2</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>101 =
=20
=
=20
-2 =
=20
=
=20
Default =20
3</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>My report then has the following =
table cell=20
entries in the Group Header section of my table:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Total.sum(row["COUNT"], =
row["STATUSCODE"] =3D=3D=20
100)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Total.sum(row["COUNT"], =
row["STATUSCODE"] =3D=3D=20
101)</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Jason Weathersby" <<A=20
=
href=3D"mailto:jweathersby@actuate.com">jweathersby@actuate.com</A>> =
wrote=20
in message <A=20
=
href=3D"news:e0hb02$6q6$1@utils.eclipse.org">news:e0hb02$6q6$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Melissa,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Are you doing the aggregation in =
the report or=20
the query?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Also when you run this report in =
the viewer and=20
use the export does it do the same thing?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Jason</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> =
wrote in=20
message <A=20
=
href=3D"news:e0h4mm$ut6$1@utils.eclipse.org">news:e0h4mm$ut6$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Jason,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The reason this issue is =
coming up=20
is because the report is grouping on my Department Name, and then=20
aggregating the data to only show one record for each unique=20
Department. Is there a way around this for the CSV =
report? Or=20
a way to access grouping information from the API?</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> =
wrote in=20
message <A=20
=
href=3D"news:e0h38f$l86$1@utils.eclipse.org">news:e0h38f$l86$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Jason,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thank you for the =
response. Sorry, it=20
does turn out to be a problem with my result set. I forgot =
that=20
the HTML version is doing special formatting of the data so =
duplicate=20
records are not shown.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: =
5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Jason Weathersby" <<A=20
=
href=3D"mailto:jweathersby@actuate.com">jweathersby@actuate.com</A>>=20
wrote in message <A=20
=
href=3D"news:e0h0gl$sr6$1@utils.eclipse.org">news:e0h0gl$sr6$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Does this happen with every =
result=20
set? If not can you verify the data?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Jason</FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: =
5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
=
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> wrote in=20
message <A=20
=
href=3D"news:e0f4up$cf$1@utils.eclipse.org">news:e0f4up$cf$1@utils.eclips=
e.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>I have the following method =
(which I=20
copied from the ReportEngineService class and then =
customized) which=20
runs and formats a report for CSV format. Most of the =
time it=20
works fine, but occasionally I have noticed that it returns=20
duplicate records. Any idea why this is =
happening? A=20
test of this code returns the following results (Note: the =
last row=20
is a duplicate):</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>
<P>Department,Hours Available,Total Assigned,Assignment=20
Expired,Taken by Assigned,Taken by Other,Agent =
Exited,Customer=20
Exited</P>
<P>assignmenttester,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Bogus Department,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Bogus DPT,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>boo,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Buenos Dias DayCare,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>CG Image Test,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>CG Image Test 2,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Chinese ?? (Simplified),0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Danish,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Default,5.0,2.0,3.0,0.0,0.0,0.0</P>
<P>Default,5.0,2.0,3.0,0.0,0.0,0.0</P></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> <FONT=20
face=3D"Times New Roman">public String getCSVReport(String =
resultSet,=20
String[] columnHeaders, Map params)<BR> =20
{<BR> IExtractionResults results =3D=20
null;<BR> IDataIterator iData =3D=20
null;<BR> String resultData =3D=20
"";<BR> StringBuffer buf =3D new =
StringBuffer(=20
);</FONT></FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2> =
try<BR> =20
{<BR> IRunTask runTask =3D=20
=
m_birtEngine.getRunTask(m_report);<BR> =20
=
runTask.setParameterValues(params);<BR> =20
runTask.run(BIRT_REPORTS_FOLDER + m_reportName +=20
REPORT_DOC_EXT);<BR> =
IReportDocument=20
doc =3D m_birtEngine.getReportDocument(BIRT_REPORTS_FOLDER + =
m_reportName +=20
REPORT_DOC_EXT);<BR> <BR> =
IDataExtractionTask task =3D=20
=
m_birtEngine.getDataExtractionTask(doc);<BR>  =
;=20
<BR> =20
=
task.selectResultSet(resultSet);<BR> =20
=
task.setLocale(Locale.ENGLISH);<BR> =20
results =3D =
task.extract();<BR> =20
<BR> if ( columnHeaders.length =
!=3D 0=20
&& results !=3D null =
)<BR> =20
{<BR> iData =3D=20
results.nextResultIterator(=20
);<BR> =
IResultMetaData md=20
=3D=20
=
iData.getResultMetaData();<BR> =
<BR> if ( iData =
!=3D null=20
)<BR> =20
=
{<BR> =20
=
buf.append(columnHeaders[0]);<BR> &nbs=
p; &nbs p;=20
=
<BR> &nb=
sp; =20
for ( int i =3D 1; i < columnHeaders.length; i++=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; =20
buf.append( ',' );=20
=
//$NON-NLS-1$<BR> &n=
bsp; &n bsp; =20
=
buf.append(columnHeaders[i]);<BR> &nbs=
p; &nbs p;=20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
buf.append("\n");</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
=
size=3D2> &nbs=
p; =20
//=20
=
Data<BR>  =
; =20
while ( iData.next( )=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; =20
String value =3D=20
=
null;<BR> &nbs=
p; &nbs p;=20
=
<BR> &nb=
sp; =20
=
try<BR> =
=20
=
{<BR> &n=
bsp; &n bsp; =20
value =3D cvsConvertor( ( String )=20
=
DataTypeUtil<BR> &nb=
sp; &nb sp; &nb s=
p; &nbs p; =20
.convert( iData.getValue( md.getColumnName(0) ),=20
DataType.STRING_TYPE )=20
=
);<BR> &=
nbsp; =20
=
}<BR> &n=
bsp; =20
catch ( Exception e=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
value =3D=20
=
null;<BR> &nbs=
p; &nbs p;=20
}</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
=
size=3D2> &nbs=
p; &nbs p;=20
if ( value !=3D null=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
buf.append( value=20
=
);<BR> &=
nbsp; =20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
for ( int i =3D 1; i < md.getColumnCount(); i++=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
buf.append( ',' );=20
=
//$NON-NLS-1$<BR> &n=
bsp; &n bsp; =20
=
<BR> &nb=
sp; &nb sp; =20
=
try<BR> =
=20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
value =3D cvsConvertor( ( String )=20
=
DataTypeUtil<BR> &nb=
sp; &nb sp; &nb s=
p; &nbs p; =20
.convert( iData.getValue( md.getColumnName(i) ),=20
DataType.STRING_TYPE )=20
=
);<BR> &=
nbsp; & nbsp; =20
=
}<BR> &n=
bsp; &n bsp; =20
catch ( Exception e=20
=
)<BR> &n=
bsp; &n bsp; =20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
value =3D=20
=
null;<BR> &nbs=
p; &nbs p; =20
=
}<BR> &n=
bsp; &n bsp; =20
=
<BR> &nb=
sp; &nb sp; =20
if ( value !=3D null=20
=
)<BR> &n=
bsp; &n bsp; =20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
buf.append( value=20
=
);<BR> &=
nbsp; & nbsp; =20
=
}<BR> &n=
bsp; =20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
=
buf.append("\n");<BR> &nbs=
p; &nbs p; =20
=
<BR> &nb=
sp; =20
}<BR> =20
}<BR> =20
}<BR> <BR> =20
}<BR> catch(Exception =
e)<BR> =20
{<BR> =
System.out.println("Exception=20
extracting report data: " + e);<BR> =20
}<BR> =20
<BR> resultData =3D buf.toString(=20
);<BR> buf.delete( 0, buf.length( )=20
);<BR> return =
resultData;<BR> =20
<BR> =20
=
}</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE ></BLOCK=
QUOTE></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_000B_01C65492.67A590E0--
|
|
|
Re: DataExtractionTask sometimes returns duplicate records [message #150061 is a reply to message #150003] |
Fri, 31 March 2006 12:37  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_001E_01C654A6.B7D6F4A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Thanks. I created Bug 134291 for this issue.
"Jason Weathersby" <jweathersby@actuate.com> wrote in message =
news:e0jgr5$h89$1@utils.eclipse.org...
Melissa,
I dont see an easy way of doing this without adding another query.
Can you log an enhancement request?
Jason
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0hlir$tj7$1@utils.eclipse.org...
Yes, the same thing happens when I run the report in the Viewer and =
use the Export functionality.
I am doing the aggregation I was talking about within the report. =
My query returns these results:
STATUSCODE DEPARTMENTID DEPARTMENT COUNT
100 -2 Default =
2
101 -2 Default =
3
My report then has the following table cell entries in the Group =
Header section of my table:
Total.sum(row["COUNT"], row["STATUSCODE"] =3D=3D 100)
Total.sum(row["COUNT"], row["STATUSCODE"] =3D=3D 101)
"Jason Weathersby" <jweathersby@actuate.com> wrote in message =
news:e0hb02$6q6$1@utils.eclipse.org...
Melissa,
Are you doing the aggregation in the report or the query?
Also when you run this report in the viewer and use the export =
does it do the same thing?
Jason
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0h4mm$ut6$1@utils.eclipse.org...
Jason,
The reason this issue is coming up is because the report is =
grouping on my Department Name, and then aggregating the data to only =
show one record for each unique Department. Is there a way around this =
for the CSV report? Or a way to access grouping information from the =
API?
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0h38f$l86$1@utils.eclipse.org...
Jason,
Thank you for the response. Sorry, it does turn out to be a =
problem with my result set. I forgot that the HTML version is doing =
special formatting of the data so duplicate records are not shown.
"Jason Weathersby" <jweathersby@actuate.com> wrote in =
message news:e0h0gl$sr6$1@utils.eclipse.org...
Does this happen with every result set? If not can you =
verify the data?
Jason
"Melissa Crist" <melcri@comcast.net> wrote in message =
news:e0f4up$cf$1@utils.eclipse.org...
I have the following method (which I copied from the =
ReportEngineService class and then customized) which runs and formats a =
report for CSV format. Most of the time it works fine, but occasionally =
I have noticed that it returns duplicate records. Any idea why this is =
happening? A test of this code returns the following results (Note: the =
last row is a duplicate):
Department,Hours Available,Total Assigned,Assignment =
Expired,Taken by Assigned,Taken by Other,Agent Exited,Customer Exited
assignmenttester,0.0,0.0,0.0,0.0,0.0,0.0
Bogus Department,0.0,0.0,0.0,0.0,0.0,0.0
Bogus DPT,0.0,0.0,0.0,0.0,0.0,0.0
boo,0.0,0.0,0.0,0.0,0.0,0.0
Buenos Dias DayCare,0.0,0.0,0.0,0.0,0.0,0.0
CG Image Test,0.0,0.0,0.0,0.0,0.0,0.0
CG Image Test 2,0.0,0.0,0.0,0.0,0.0,0.0
Chinese ?? (Simplified),0.0,0.0,0.0,0.0,0.0,0.0
Danish,0.0,0.0,0.0,0.0,0.0,0.0
Default,5.0,2.0,3.0,0.0,0.0,0.0
Default,5.0,2.0,3.0,0.0,0.0,0.0
public String getCSVReport(String resultSet, String[] =
columnHeaders, Map params)
{
IExtractionResults results =3D null;
IDataIterator iData =3D null;
String resultData =3D "";
StringBuffer buf =3D new StringBuffer( );
try
{
IRunTask runTask =3D =
m_birtEngine.getRunTask(m_report);
runTask.setParameterValues(params);
runTask.run(BIRT_REPORTS_FOLDER + m_reportName + =
REPORT_DOC_EXT);
IReportDocument doc =3D =
m_birtEngine.getReportDocument(BIRT_REPORTS_FOLDER + m_reportName + =
REPORT_DOC_EXT);
=20
IDataExtractionTask task =3D =
m_birtEngine.getDataExtractionTask(doc);
=20
task.selectResultSet(resultSet);
task.setLocale(Locale.ENGLISH);
results =3D task.extract();
=20
if ( columnHeaders.length !=3D 0 && results !=3D =
null )
{
iData =3D results.nextResultIterator( );
IResultMetaData md =3D iData.getResultMetaData();
=20
if ( iData !=3D null )
{
buf.append(columnHeaders[0]);
=20
for ( int i =3D 1; i < columnHeaders.length; =
i++ )
{
buf.append( ',' ); //$NON-NLS-1$
buf.append(columnHeaders[i]);
}
=20
buf.append("\n");
// Data
while ( iData.next( ) )
{
String value =3D null;
=20
try
{
value =3D cvsConvertor( ( String ) =
DataTypeUtil
.convert( iData.getValue( =
md.getColumnName(0) ), DataType.STRING_TYPE ) );
}
catch ( Exception e )
{
value =3D null;
}
if ( value !=3D null )
{
buf.append( value );
}
=20
for ( int i =3D 1; i < =
md.getColumnCount(); i++ )
{
buf.append( ',' ); //$NON-NLS-1$
=20
try
{
value =3D cvsConvertor( ( String =
) DataTypeUtil
.convert( =
iData.getValue( md.getColumnName(i) ), DataType.STRING_TYPE ) );
}
catch ( Exception e )
{
value =3D null;
}
=20
if ( value !=3D null )
{
buf.append( value );
}
}
=20
buf.append("\n");
=20
}
}
}
=20
}
catch(Exception e)
{
System.out.println("Exception extracting report =
data: " + e);
}
=20
resultData =3D buf.toString( );
buf.delete( 0, buf.length( ) );
return resultData;
=20
}
------=_NextPart_000_001E_01C654A6.B7D6F4A0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2802" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Thanks. I created Bug 134291 for =
this=20
issue.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Jason Weathersby" <<A=20
=
href=3D"mailto:jweathersby@actuate.com">jweathersby@actuate.com</A>> =
wrote in=20
message <A=20
=
href=3D"news:e0jgr5$h89$1@utils.eclipse.org">news:e0jgr5$h89$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Melissa,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>I dont see an easy way of doing this =
without=20
adding another query.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Can you log an enhancement =
request?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Jason</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> wrote =
in message=20
<A=20
=
href=3D"news:e0hlir$tj7$1@utils.eclipse.org">news:e0hlir$tj7$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Yes, the same thing happens when I =
run the=20
report in the Viewer and use the Export functionality.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>I am doing the aggregation I was talking about within the =
report. =20
My query returns these results:</DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>STATUSCODE =
=20
DEPARTMENTID =20
DEPARTMENT COUNT</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>100 =
=20
=
=20
-2 =20
=
=20
Default =20
=
2</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>101 =
=20
=
=20
-2 =20
=
=20
Default =20
=
3</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>My report then has the following =
table cell=20
entries in the Group Header section of my table:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Total.sum(row["COUNT"], =
row["STATUSCODE"] =3D=3D=20
100)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Total.sum(row["COUNT"], =
row["STATUSCODE"] =3D=3D=20
101)</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Jason Weathersby" <<A=20
=
href=3D"mailto:jweathersby@actuate.com">jweathersby@actuate.com</A>>=20
wrote in message <A=20
=
href=3D"news:e0hb02$6q6$1@utils.eclipse.org">news:e0hb02$6q6$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Melissa,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Are you doing the aggregation in =
the report=20
or the query?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Also when you run this report in =
the viewer=20
and use the export does it do the same thing?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Jason</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> =
wrote in=20
message <A=20
=
href=3D"news:e0h4mm$ut6$1@utils.eclipse.org">news:e0h4mm$ut6$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Jason,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The reason this issue is=20
coming up is because the report is grouping on my =
Department Name,=20
and then aggregating the data to only show one record for each =
unique=20
Department. Is there a way around this for the CSV =
report? =20
Or a way to access grouping information from the =
API?</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: =
5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> =
wrote in=20
message <A=20
=
href=3D"news:e0h38f$l86$1@utils.eclipse.org">news:e0h38f$l86$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Jason,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thank you for the =
response. Sorry,=20
it does turn out to be a problem with my result set. I =
forgot=20
that the HTML version is doing special formatting of the data =
so=20
duplicate records are not shown.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: =
5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Jason Weathersby" <<A=20
=
href=3D"mailto:jweathersby@actuate.com">jweathersby@actuate.com</A>>=20
wrote in message <A=20
=
href=3D"news:e0h0gl$sr6$1@utils.eclipse.org">news:e0h0gl$sr6$1@utils.ecli=
pse.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Does this happen with every =
result=20
set? If not can you verify the data?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Jason</FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: =
5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Melissa Crist" <<A=20
=
href=3D"mailto:melcri@comcast.net">melcri@comcast.net</A>> wrote=20
in message <A=20
=
href=3D"news:e0f4up$cf$1@utils.eclipse.org">news:e0f4up$cf$1@utils.eclips=
e.org</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>I have the following =
method (which I=20
copied from the ReportEngineService class and then =
customized)=20
which runs and formats a report for CSV format. Most =
of the=20
time it works fine, but occasionally I have noticed that =
it=20
returns duplicate records. Any idea why this is=20
happening? A test of this code returns the following =
results=20
(Note: the last row is a duplicate):</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>
<P>Department,Hours Available,Total Assigned,Assignment=20
Expired,Taken by Assigned,Taken by Other,Agent =
Exited,Customer=20
Exited</P>
<P>assignmenttester,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Bogus Department,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Bogus DPT,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>boo,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Buenos Dias DayCare,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>CG Image Test,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>CG Image Test 2,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Chinese ?? (Simplified),0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Danish,0.0,0.0,0.0,0.0,0.0,0.0</P>
<P>Default,5.0,2.0,3.0,0.0,0.0,0.0</P>
<P>Default,5.0,2.0,3.0,0.0,0.0,0.0</P></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> <FONT=20
face=3D"Times New Roman">public String getCSVReport(String =
resultSet, String[] columnHeaders, Map params)<BR> =20
{<BR> IExtractionResults results =3D=20
null;<BR> IDataIterator iData =3D=20
null;<BR> String resultData =3D=20
"";<BR> StringBuffer buf =3D new =
StringBuffer(=20
);</FONT></FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2> =
try<BR> =20
{<BR> IRunTask runTask =3D=20
=
m_birtEngine.getRunTask(m_report);<BR> =20
=
runTask.setParameterValues(params);<BR> =20
runTask.run(BIRT_REPORTS_FOLDER + m_reportName +=20
REPORT_DOC_EXT);<BR> =
IReportDocument=20
doc =3D m_birtEngine.getReportDocument(BIRT_REPORTS_FOLDER =
+=20
m_reportName +=20
=
REPORT_DOC_EXT);<BR> <BR> =20
IDataExtractionTask task =3D=20
=
m_birtEngine.getDataExtractionTask(doc);<BR>  =
;=20
<BR> =20
=
task.selectResultSet(resultSet);<BR> =20
=
task.setLocale(Locale.ENGLISH);<BR> =20
results =3D =
task.extract();<BR> =20
<BR> if ( =
columnHeaders.length !=3D 0=20
&& results !=3D null =
)<BR> =20
{<BR> iData =3D=20
results.nextResultIterator(=20
);<BR> =
IResultMetaData=20
md =3D=20
=
iData.getResultMetaData();<BR> =
<BR> if ( iData =
!=3D null=20
)<BR> =20
=
{<BR> =20
=
buf.append(columnHeaders[0]);<BR> &nbs=
p; &nbs p;=20
=
<BR> &nb=
sp; =20
for ( int i =3D 1; i < columnHeaders.length; i++=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; =20
buf.append( ',' );=20
=
//$NON-NLS-1$<BR> &n=
bsp; &n bsp; =20
=
buf.append(columnHeaders[i]);<BR> &nbs=
p; &nbs p;=20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
buf.append("\n");</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
=
size=3D2> &nbs=
p; =20
//=20
=
Data<BR>  =
; =20
while ( iData.next( )=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; =20
String value =3D=20
=
null;<BR> &nbs=
p; &nbs p;=20
=
<BR> &nb=
sp; =20
=
try<BR> =
=20
=
{<BR> &n=
bsp; &n bsp; =20
value =3D cvsConvertor( ( String )=20
=
DataTypeUtil<BR> &nb=
sp; &nb sp; &nb s=
p; &nbs p; =20
.convert( iData.getValue( md.getColumnName(0) ),=20
DataType.STRING_TYPE )=20
=
);<BR> &=
nbsp; =20
=
}<BR> &n=
bsp; =20
catch ( Exception e=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
value =3D=20
=
null;<BR> &nbs=
p; &nbs p;=20
}</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT=20
=
size=3D2> &nbs=
p; &nbs p;=20
if ( value !=3D null=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
buf.append( value=20
=
);<BR> &=
nbsp; =20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
for ( int i =3D 1; i < md.getColumnCount(); i++=20
=
)<BR> &n=
bsp; =20
=
{<BR> &n=
bsp; &n bsp; =20
buf.append( ',' );=20
=
//$NON-NLS-1$<BR> &n=
bsp; &n bsp; =20
=
<BR> &nb=
sp; &nb sp; =20
=
try<BR> =
=20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
value =3D cvsConvertor( ( String )=20
=
DataTypeUtil<BR> &nb=
sp; &nb sp; &nb s=
p; &nbs p; =20
.convert( iData.getValue( md.getColumnName(i) ),=20
DataType.STRING_TYPE )=20
=
);<BR> &=
nbsp; & nbsp; =20
=
}<BR> &n=
bsp; &n bsp; =20
catch ( Exception e=20
=
)<BR> &n=
bsp; &n bsp; =20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
value =3D=20
=
null;<BR> &nbs=
p; &nbs p; =20
=
}<BR> &n=
bsp; &n bsp; =20
=
<BR> &nb=
sp; &nb sp; =20
if ( value !=3D null=20
=
)<BR> &n=
bsp; &n bsp; =20
=
{<BR> &n=
bsp; &n bsp; &n b=
sp; =20
buf.append( value=20
=
);<BR> &=
nbsp; & nbsp; =20
=
}<BR> &n=
bsp; =20
=
}<BR> &n=
bsp; =20
=
<BR> &nb=
sp; =20
=
buf.append("\n");<BR> &nbs=
p; &nbs p; =20
=
<BR> &nb=
sp; =20
=
}<BR> =20
}<BR> =20
}<BR> <BR> =
}<BR> catch(Exception =
e)<BR> =20
{<BR> =
System.out.println("Exception=20
extracting report data: " + e);<BR> =20
}<BR> =20
<BR> resultData =3D buf.toString(=20
);<BR> buf.delete( 0, buf.length( )=20
);<BR> return =
resultData;<BR> =20
<BR> =20
=
}</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE ></BLOCK=
QUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_001E_01C654A6.B7D6F4A0--
|
|
|
Goto Forum:
Current Time: Wed Jul 16 23:03:45 EDT 2025
Powered by FUDForum. Page generated in 1.25128 seconds
|