Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Custom emitter: Get Data Types & startTable Event(Get Data Types & startTable Event)
Custom emitter: Get Data Types & startTable Event [message #733872] Wed, 05 October 2011 20:16 Go to next message
seha Missing name is currently offline seha Missing name
Messages: 13
Registered: September 2011
Junior Member
Hallo all!

I'm quite new to Birt.
I started writing a new custom emitter for Birt based on the book Integrating and Extending BIRT (3rd edition).

How can I get the native data types (String, Interger, Decimal...) of content passed to an emitter or the data type of the column?
I know that is possible to get this information by using IDataExtractionTask, but how can I do this in my emitter class?

The other thing is that the startTable event starts for grids, tables and crosstabs. Is there any possibility to distinguish between table and crosstab?

Many thanks!
seha
Re: Custom emitter: Get Data Types & startTable Event [message #733898 is a reply to message #733872] Wed, 05 October 2011 21:40 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Are you talking about on the StartData event?
If so you can always check the the type of

public void startData( IDataContent data )
{ {
Object mydata = data.getValue();

if( mydata instanceof Integer){


}
...

On checking a table vs crosstab vs grid use the getGenerateBy call see
below.


public void startTable( ITableContent table )
{
assert table != null;
Object generatedBy = table.getGenerateBy();

if( generatedBy instanceof TableItemDesign ){
//ExtendedItemDesign
//GridItemDesign

}


You could also call the data engine and get the data for the table like:

public void startTable( ITableContent table )
{
assert table != null;
Object generatedBy = table.getGenerateBy();

if( generatedBy instanceof TableItemDesign ){
//ExtendedItemDesign
//GridItemDesign
System.out.println("Table Instance");
IDataQueryDefinition idqd = ((TableItemDesign) generatedBy).getQuery();


ExecutionContext exeContext = ( (ReportContent)
table.getReportContent( ) ).getExecutionContext( );

try {
IDataEngine de = (IDataEngine) exeContext.getDataEngine();

//org.eclipse.birt.report.engine.data.dte.QueryResultSet
QueryResultSet qr = (QueryResultSet) de.execute( idqd );



IResultIterator ri = qr.getResultIterator( );
int cc = ri.getResultMetaData().getColumnCount();
IResultMetaData rsmd = ri.getResultMetaData();


while ( ri.next( ) )
{


for ( int i = 0; i < cc; i++ )
System.out.print(ri.getValue(rsmd.getColumnName(i+1)) + " ");

System.out.println("");
}

ri.close( );
qr.close( );

} catch (EngineException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
} catch (BirtException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}

}


But this only gives you the table bindings which may be more than what
is displayed in the table.

Jason

On 10/5/2011 4:16 PM, seha wrote:
> Hallo all!
>
> I'm quite new to Birt. I started writing a new custom emitter for Birt
> based on the book Integrating and Extending BIRT (3rd edition).
>
> How can I get the native data types (String, Interger, Decimal...) of
> content passed to an emitter or the data type of the column? I know that
> is possible to get this information by using IDataExtractionTask, but
> how can I do this in my emitter class?
>
> The other thing is that the startTable event starts for grids, tables
> and crosstabs. Is there any possibility to distinguish between table and
> crosstab?
>
> Many thanks!
> seha
Re: Custom emitter: Get Data Types &amp; startTable Event [message #733924 is a reply to message #733898] Thu, 06 October 2011 00:12 Go to previous messageGo to next message
seha Missing name is currently offline seha Missing name
Messages: 13
Registered: September 2011
Junior Member
Hi Jason,

thank you so much for your answer! That's exactly what I need.


My approach was

public void startData( IDataContent data ){

if(data.getValue() != null){
System.out.println(data.getValue().getClass().getSimpleName());

}
...

I thought there is a direct way to obtain information about the native data type, so I spent a lot of time searching in vain.

I still don't have any idea how to map the charts because they are passed to an emitter as images (startImage event). Is it possible to get the information about the chart, such as chart typ, data, axis labels etc.

Many thanks in advance!

seha

Jason Weathersby wrote on Wed, 05 October 2011 17:40
Are you talking about on the StartData event?
If so you can always check the the type of

public void startData( IDataContent data )
{ {
Object mydata = data.getValue();

if( mydata instanceof Integer){


}
...

On checking a table vs crosstab vs grid use the getGenerateBy call see
below.


public void startTable( ITableContent table )
{
assert table != null;
Object generatedBy = table.getGenerateBy();

if( generatedBy instanceof TableItemDesign ){
//ExtendedItemDesign
//GridItemDesign

}


You could also call the data engine and get the data for the table like:

public void startTable( ITableContent table )
{
assert table != null;
Object generatedBy = table.getGenerateBy();

if( generatedBy instanceof TableItemDesign ){
//ExtendedItemDesign
//GridItemDesign
System.out.println("Table Instance");
IDataQueryDefinition idqd = ((TableItemDesign) generatedBy).getQuery();


ExecutionContext exeContext = ( (ReportContent)
table.getReportContent( ) ).getExecutionContext( );

try {
IDataEngine de = (IDataEngine) exeContext.getDataEngine();

//org.eclipse.birt.report.engine.data.dte.QueryResultSet
QueryResultSet qr = (QueryResultSet) de.execute( idqd );



IResultIterator ri = qr.getResultIterator( );
int cc = ri.getResultMetaData().getColumnCount();
IResultMetaData rsmd = ri.getResultMetaData();


while ( ri.next( ) )
{


for ( int i = 0; i < cc; i++ )
System.out.print(ri.getValue(rsmd.getColumnName(i+1)) + " ");

System.out.println("");
}

ri.close( );
qr.close( );

} catch (EngineException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
} catch (BirtException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}

}


But this only gives you the table bindings which may be more than what
is displayed in the table.

Jason

On 10/5/2011 4:16 PM, seha wrote:
> Hallo all!
>
> I'm quite new to Birt. I started writing a new custom emitter for Birt
> based on the book Integrating and Extending BIRT (3rd edition).
>
> How can I get the native data types (String, Interger, Decimal...) of
> content passed to an emitter or the data type of the column? I know that
> is possible to get this information by using IDataExtractionTask, but
> how can I do this in my emitter class?
>
> The other thing is that the startTable event starts for grids, tables
> and crosstabs. Is there any possibility to distinguish between table and
> crosstab?
>
> Many thanks!
> seha

Re: Custom emitter: Get Data Types &amp;amp; startTable Event [message #734089 is a reply to message #733924] Thu, 06 October 2011 15:45 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Not sure if it will help but you can get the chart design like:

public void startImage( IImageContent image )
{

Object genby = image.getGenerateBy();
if( genby instanceof ExtendedItemDesign){

ExtendedItemDesign mychart = (ExtendedItemDesign) image.getGenerateBy();
long deh = mychart.getHandle().getID();
ReportDesignHandle rdh =
image.getReportContent().getDesign().getReportDesign();


//ExtendedItemHandle eih = (ExtendedItemHandle) rdh.getBody(
).getContents( ).get( 0 );
ExtendedItemHandle eih = (ExtendedItemHandle) rdh.getElementByID(deh);

try {
Chart cm = (Chart) eih.getReportItem( ).getProperty( "chart.instance" );
//use chart api to retrieve chart design properties

System.out.println("test");
} catch (ExtendedElementException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Jason

On 10/5/2011 8:12 PM, seha wrote:
> Hi Jason,
>
> thank you so much for your answer! That's exactly what I need.
>
>
> My approach was
> public void startData( IDataContent data ){
>
> if(data.getValue() != null){
> System.out.println(data.getValue().getClass().getSimpleName());
>
> } ...
>
> I thought there is a direct way to obtain information about the native
> data type, so I spent a lot of time searching in vain.
> I still don't have any idea how to map the charts because they are
> passed to an emitter as images (startImage event). Is it possible to get
> the information about the chart, such as chart typ, data, axis labels etc.
> Many thanks in advance!
>
> seha
>
> Jason Weathersby wrote on Wed, 05 October 2011 17:40
>> Are you talking about on the StartData event?
>> If so you can always check the the type of
>>
>> public void startData( IDataContent data )
>> { {
>> Object mydata = data.getValue();
>>
>> if( mydata instanceof Integer){
>>
>>
>> }
>> ...
>>
>> On checking a table vs crosstab vs grid use the getGenerateBy call see
>> below.
>>
>>
>> public void startTable( ITableContent table )
>> {
>> assert table != null;
>> Object generatedBy = table.getGenerateBy();
>>
>> if( generatedBy instanceof TableItemDesign ){
>> //ExtendedItemDesign
>> //GridItemDesign
>>
>> }
>>
>>
>> You could also call the data engine and get the data for the table like:
>>
>> public void startTable( ITableContent table )
>> {
>> assert table != null;
>> Object generatedBy = table.getGenerateBy();
>>
>> if( generatedBy instanceof TableItemDesign ){
>> //ExtendedItemDesign
>> //GridItemDesign
>> System.out.println("Table Instance");
>> IDataQueryDefinition idqd = ((TableItemDesign) generatedBy).getQuery();
>>
>>
>> ExecutionContext exeContext = ( (ReportContent)
>> table.getReportContent( ) ).getExecutionContext( );
>>
>> try {
>> IDataEngine de = (IDataEngine) exeContext.getDataEngine();
>>
>> //org.eclipse.birt.report.engine.data.dte.QueryResultSet
>> QueryResultSet qr = (QueryResultSet) de.execute( idqd );
>>
>>
>>
>> IResultIterator ri = qr.getResultIterator( );
>> int cc = ri.getResultMetaData().getColumnCount();
>> IResultMetaData rsmd = ri.getResultMetaData();
>>
>>
>> while ( ri.next( ) )
>> {
>>
>>
>> for ( int i = 0; i < cc; i++ )
>> System.out.print(ri.getValue(rsmd.getColumnName(i+1)) + " ");
>>
>> System.out.println("");
>> }
>>
>> ri.close( );
>> qr.close( );
>>
>> } catch (EngineException e2) {
>> // TODO Auto-generated catch block
>> e2.printStackTrace();
>> } catch (BirtException e2) {
>> // TODO Auto-generated catch block
>> e2.printStackTrace();
>> }
>>
>> }
>>
>>
>> But this only gives you the table bindings which may be more than what
>> is displayed in the table.
>>
>> Jason
>>
>> On 10/5/2011 4:16 PM, seha wrote:
>> > Hallo all!
>> >
>> > I'm quite new to Birt. I started writing a new custom emitter for Birt
>> > based on the book Integrating and Extending BIRT (3rd edition).
>> >
>> > How can I get the native data types (String, Interger, Decimal...) of
>> > content passed to an emitter or the data type of the column? I know
>> that
>> > is possible to get this information by using IDataExtractionTask, but
>> > how can I do this in my emitter class?
>> >
>> > The other thing is that the startTable event starts for grids, tables
>> > and crosstabs. Is there any possibility to distinguish between table
>> and
>> > crosstab?
>> >
>> > Many thanks!
>> > seha
>
>
Re: Custom emitter: Get Data Types &amp;amp; startTable Event [message #734156 is a reply to message #734089] Thu, 06 October 2011 22:00 Go to previous messageGo to next message
seha Missing name is currently offline seha Missing name
Messages: 13
Registered: September 2011
Junior Member
Hi Jason,

many thanks for your valuable hint!

My primary task is to map report items to javascript widgets and therefore I need to have all required information. In case that for some reason your hint is not the right approach in my case, do you see any other posibility to get the information about the charts?

Do I always have to use the Data Engine API to get the data related to a report item?
Can I also use the Design Engine API? How does it work for charts?

Thanks in advance!

seha


Jason Weathersby wrote on Thu, 06 October 2011 11:45
Not sure if it will help but you can get the chart design like:

public void startImage( IImageContent image )
{

Object genby = image.getGenerateBy();
if( genby instanceof ExtendedItemDesign){

ExtendedItemDesign mychart = (ExtendedItemDesign) image.getGenerateBy();
long deh = mychart.getHandle().getID();
ReportDesignHandle rdh =
image.getReportContent().getDesign().getReportDesign();


//ExtendedItemHandle eih = (ExtendedItemHandle) rdh.getBody(
).getContents( ).get( 0 );
ExtendedItemHandle eih = (ExtendedItemHandle) rdh.getElementByID(deh);

try {
Chart cm = (Chart) eih.getReportItem( ).getProperty( "chart.instance" );
//use chart api to retrieve chart design properties

System.out.println("test");
} catch (ExtendedElementException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Jason

On 10/5/2011 8:12 PM, seha wrote:
> Hi Jason,
>
> thank you so much for your answer! That's exactly what I need.
>
>
> My approach was
> public void startData( IDataContent data ){
>
> if(data.getValue() != null){
> System.out.println(data.getValue().getClass().getSimpleName());
>
> } ...
>
> I thought there is a direct way to obtain information about the native
> data type, so I spent a lot of time searching in vain.
> I still don't have any idea how to map the charts because they are
> passed to an emitter as images (startImage event). Is it possible to get
> the information about the chart, such as chart typ, data, axis labels etc.
> Many thanks in advance!
>
> seha
>
> Jason Weathersby wrote on Wed, 05 October 2011 17:40
>> Are you talking about on the StartData event?
>> If so you can always check the the type of
>>
>> public void startData( IDataContent data )
>> { {
>> Object mydata = data.getValue();
>>
>> if( mydata instanceof Integer){
>>
>>
>> }
>> ...
>>
>> On checking a table vs crosstab vs grid use the getGenerateBy call see
>> below.
>>
>>
>> public void startTable( ITableContent table )
>> {
>> assert table != null;
>> Object generatedBy = table.getGenerateBy();
>>
>> if( generatedBy instanceof TableItemDesign ){
>> //ExtendedItemDesign
>> //GridItemDesign
>>
>> }
>>
>>
>> You could also call the data engine and get the data for the table like:
>>
>> public void startTable( ITableContent table )
>> {
>> assert table != null;
>> Object generatedBy = table.getGenerateBy();
>>
>> if( generatedBy instanceof TableItemDesign ){
>> //ExtendedItemDesign
>> //GridItemDesign
>> System.out.println("Table Instance");
>> IDataQueryDefinition idqd = ((TableItemDesign) generatedBy).getQuery();
>>
>>
>> ExecutionContext exeContext = ( (ReportContent)
>> table.getReportContent( ) ).getExecutionContext( );
>>
>> try {
>> IDataEngine de = (IDataEngine) exeContext.getDataEngine();
>>
>> //org.eclipse.birt.report.engine.data.dte.QueryResultSet
>> QueryResultSet qr = (QueryResultSet) de.execute( idqd );
>>
>>
>>
>> IResultIterator ri = qr.getResultIterator( );
>> int cc = ri.getResultMetaData().getColumnCount();
>> IResultMetaData rsmd = ri.getResultMetaData();
>>
>>
>> while ( ri.next( ) )
>> {
>>
>>
>> for ( int i = 0; i < cc; i++ )
>> System.out.print(ri.getValue(rsmd.getColumnName(i+1)) + " ");
>>
>> System.out.println("");
>> }
>>
>> ri.close( );
>> qr.close( );
>>
>> } catch (EngineException e2) {
>> // TODO Auto-generated catch block
>> e2.printStackTrace();
>> } catch (BirtException e2) {
>> // TODO Auto-generated catch block
>> e2.printStackTrace();
>> }
>>
>> }
>>
>>
>> But this only gives you the table bindings which may be more than what
>> is displayed in the table.
>>
>> Jason
>>
>> On 10/5/2011 4:16 PM, seha wrote:
>> > Hallo all!
>> >
>> > I'm quite new to Birt. I started writing a new custom emitter for Birt
>> > based on the book Integrating and Extending BIRT (3rd edition).
>> >
>> > How can I get the native data types (String, Interger, Decimal...) of
>> > content passed to an emitter or the data type of the column? I know
>> that
>> > is possible to get this information by using IDataExtractionTask, but
>> > how can I do this in my emitter class?
>> >
>> > The other thing is that the startTable event starts for grids, tables
>> > and crosstabs. Is there any possibility to distinguish between table
>> and
>> > crosstab?
>> >
>> > Many thanks!
>> > seha
>
>

Re: Custom emitter: Get Data Types &amp;amp;amp; startTable Event [message #734364 is a reply to message #734156] Fri, 07 October 2011 14:36 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

I believe you can get it like:

ExtendedItemDesign mychart = (ExtendedItemDesign) image.getGenerateBy();


IDataQueryDefinition qd = mychart.getQuery();
try {
IDataEngine de = (IDataEngine) exeContext.getDataEngine();

//org.eclipse.birt.report.engine.data.dte.QueryResultSet
QueryResultSet qr = (QueryResultSet) de.execute( qd );



IResultIterator ri = qr.getResultIterator( );
int cc = ri.getResultMetaData().getColumnCount();
IResultMetaData rsmd = ri.getResultMetaData();


while ( ri.next( ) )
{


for ( int i = 0; i < cc; i++ )
System.out.print(ri.getValue(rsmd.getColumnName(i+1)) + " ");

System.out.println("");
}

ri.close( );
qr.close( );

} catch (EngineException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
} catch (BirtException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}



Jason

On 10/6/2011 6:00 PM, seha wrote:
> Hi Jason,
>
> many thanks for your valuable hint!
>
> My primary task is to map report items to javascript widgets and
> therefore I need to have all required information. In case that for some
> reason your hint is not the right approach in my case, do you see any
> other posibility to get the information about the charts?
>
> Do I always have to use the Data Engine API to get the data related to a
> report item?
> Can I also use the Design Engine API? How does it work for charts?
> Thanks in advance!
>
> seha
>
>
> Jason Weathersby wrote on Thu, 06 October 2011 11:45
>> Not sure if it will help but you can get the chart design like:
>>
>> public void startImage( IImageContent image )
>> {
>>
>> Object genby = image.getGenerateBy();
>> if( genby instanceof ExtendedItemDesign){
>>
>> ExtendedItemDesign mychart = (ExtendedItemDesign) image.getGenerateBy();
>> long deh = mychart.getHandle().getID();
>> ReportDesignHandle rdh =
>> image.getReportContent().getDesign().getReportDesign();
>>
>>
>> //ExtendedItemHandle eih = (ExtendedItemHandle) rdh.getBody(
>> ).getContents( ).get( 0 );
>> ExtendedItemHandle eih = (ExtendedItemHandle) rdh.getElementByID(deh);
>>
>> try {
>> Chart cm = (Chart) eih.getReportItem( ).getProperty( "chart.instance" );
>> //use chart api to retrieve chart design properties
>>
>> System.out.println("test");
>> } catch (ExtendedElementException e) {
>> // TODO Auto-generated catch block
>> e.printStackTrace();
>> }
>> Jason
>>
>> On 10/5/2011 8:12 PM, seha wrote:
>> > Hi Jason,
>> >
>> > thank you so much for your answer! That's exactly what I need.
>> >
>> >
>> > My approach was
>> > public void startData( IDataContent data ){
>> >
>> > if(data.getValue() != null){
>> > System.out.println(data.getValue().getClass().getSimpleName());
>> >
>> > } ...
>> >
>> > I thought there is a direct way to obtain information about the native
>> > data type, so I spent a lot of time searching in vain.
>> > I still don't have any idea how to map the charts because they are
>> > passed to an emitter as images (startImage event). Is it possible to
>> get
>> > the information about the chart, such as chart typ, data, axis
>> labels etc.
>> > Many thanks in advance!
>> >
>> > seha
>> >
>> > Jason Weathersby wrote on Wed, 05 October 2011 17:40
>> >> Are you talking about on the StartData event?
>> >> If so you can always check the the type of
>> >>
>> >> public void startData( IDataContent data )
>> >> { {
>> >> Object mydata = data.getValue();
>> >>
>> >> if( mydata instanceof Integer){
>> >>
>> >>
>> >> }
>> >> ...
>> >>
>> >> On checking a table vs crosstab vs grid use the getGenerateBy call see
>> >> below.
>> >>
>> >>
>> >> public void startTable( ITableContent table )
>> >> {
>> >> assert table != null;
>> >> Object generatedBy = table.getGenerateBy();
>> >>
>> >> if( generatedBy instanceof TableItemDesign ){
>> >> //ExtendedItemDesign
>> >> //GridItemDesign
>> >>
>> >> }
>> >>
>> >>
>> >> You could also call the data engine and get the data for the table
>> like:
>> >>
>> >> public void startTable( ITableContent table )
>> >> {
>> >> assert table != null;
>> >> Object generatedBy = table.getGenerateBy();
>> >>
>> >> if( generatedBy instanceof TableItemDesign ){
>> >> //ExtendedItemDesign
>> >> //GridItemDesign
>> >> System.out.println("Table Instance");
>> >> IDataQueryDefinition idqd = ((TableItemDesign)
>> generatedBy).getQuery();
>> >>
>> >>
>> >> ExecutionContext exeContext = ( (ReportContent)
>> >> table.getReportContent( ) ).getExecutionContext( );
>> >>
>> >> try {
>> >> IDataEngine de = (IDataEngine) exeContext.getDataEngine();
>> >>
>> >> //org.eclipse.birt.report.engine.data.dte.QueryResultSet
>> >> QueryResultSet qr = (QueryResultSet) de.execute( idqd );
>> >>
>> >>
>> >>
>> >> IResultIterator ri = qr.getResultIterator( );
>> >> int cc = ri.getResultMetaData().getColumnCount();
>> >> IResultMetaData rsmd = ri.getResultMetaData();
>> >>
>> >>
>> >> while ( ri.next( ) )
>> >> {
>> >>
>> >>
>> >> for ( int i = 0; i < cc; i++ )
>> >> System.out.print(ri.getValue(rsmd.getColumnName(i+1)) + " ");
>> >>
>> >> System.out.println("");
>> >> }
>> >>
>> >> ri.close( );
>> >> qr.close( );
>> >>
>> >> } catch (EngineException e2) {
>> >> // TODO Auto-generated catch block
>> >> e2.printStackTrace();
>> >> } catch (BirtException e2) {
>> >> // TODO Auto-generated catch block
>> >> e2.printStackTrace();
>> >> }
>> >>
>> >> }
>> >>
>> >>
>> >> But this only gives you the table bindings which may be more than what
>> >> is displayed in the table.
>> >>
>> >> Jason
>> >>
>> >> On 10/5/2011 4:16 PM, seha wrote:
>> >> > Hallo all!
>> >> >
>> >> > I'm quite new to Birt. I started writing a new custom emitter for
>> Birt
>> >> > based on the book Integrating and Extending BIRT (3rd edition).
>> >> >
>> >> > How can I get the native data types (String, Interger,
>> Decimal...) of
>> >> > content passed to an emitter or the data type of the column? I know
>> >> that
>> >> > is possible to get this information by using IDataExtractionTask,
>> but
>> >> > how can I do this in my emitter class?
>> >> >
>> >> > The other thing is that the startTable event starts for grids,
>> tables
>> >> > and crosstabs. Is there any possibility to distinguish between table
>> >> and
>> >> > crosstab?
>> >> >
>> >> > Many thanks!
>> >> > seha
>> >
>> >
>
>
Re: Custom emitter: Get Data Types &amp;amp;amp; startTable Event [message #735341 is a reply to message #734364] Tue, 11 October 2011 14:58 Go to previous messageGo to next message
seha Missing name is currently offline seha Missing name
Messages: 13
Registered: September 2011
Junior Member
Hi Jason,

I tried to get the data, but it doesn't work because the IDataQueryDefinition type is missing in the 2.6.0 version. Do you have any further suggestion?

seha

Jason Weathersby wrote on Fri, 07 October 2011 10:36
I believe you can get it like:

ExtendedItemDesign mychart = (ExtendedItemDesign) image.getGenerateBy();


IDataQueryDefinition qd = mychart.getQuery();
try {
IDataEngine de = (IDataEngine) exeContext.getDataEngine();

//org.eclipse.birt.report.engine.data.dte.QueryResultSet
QueryResultSet qr = (QueryResultSet) de.execute( qd );



IResultIterator ri = qr.getResultIterator( );
int cc = ri.getResultMetaData().getColumnCount();
IResultMetaData rsmd = ri.getResultMetaData();


while ( ri.next( ) )
{


for ( int i = 0; i < cc; i++ )
System.out.print(ri.getValue(rsmd.getColumnName(i+1)) + " ");

System.out.println("");
}

ri.close( );
qr.close( );

} catch (EngineException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
} catch (BirtException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}



Jason

On 10/6/2011 6:00 PM, seha wrote:
> Hi Jason,
>
> many thanks for your valuable hint!
>
> My primary task is to map report items to javascript widgets and
> therefore I need to have all required information. In case that for some
> reason your hint is not the right approach in my case, do you see any
> other posibility to get the information about the charts?
>
> Do I always have to use the Data Engine API to get the data related to a
> report item?
> Can I also use the Design Engine API? How does it work for charts?
> Thanks in advance!
>
> seha
>
>
> Jason Weathersby wrote on Thu, 06 October 2011 11:45
>> Not sure if it will help but you can get the chart design like:
>>
>> public void startImage( IImageContent image )
>> {
>>
>> Object genby = image.getGenerateBy();
>> if( genby instanceof ExtendedItemDesign){
>>
>> ExtendedItemDesign mychart = (ExtendedItemDesign) image.getGenerateBy();
>> long deh = mychart.getHandle().getID();
>> ReportDesignHandle rdh =
>> image.getReportContent().getDesign().getReportDesign();
>>
>>
>> //ExtendedItemHandle eih = (ExtendedItemHandle) rdh.getBody(
>> ).getContents( ).get( 0 );
>> ExtendedItemHandle eih = (ExtendedItemHandle) rdh.getElementByID(deh);
>>
>> try {
>> Chart cm = (Chart) eih.getReportItem( ).getProperty( "chart.instance" );
>> //use chart api to retrieve chart design properties
>>
>> System.out.println("test");
>> } catch (ExtendedElementException e) {
>> // TODO Auto-generated catch block
>> e.printStackTrace();
>> }
>> Jason
>>
>> On 10/5/2011 8:12 PM, seha wrote:
>> > Hi Jason,
>> >
>> > thank you so much for your answer! That's exactly what I need.
>> >
>> >
>> > My approach was
>> > public void startData( IDataContent data ){
>> >
>> > if(data.getValue() != null){
>> > System.out.println(data.getValue().getClass().getSimpleName());
>> >
>> > } ...
>> >
>> > I thought there is a direct way to obtain information about the native
>> > data type, so I spent a lot of time searching in vain.
>> > I still don't have any idea how to map the charts because they are
>> > passed to an emitter as images (startImage event). Is it possible to
>> get
>> > the information about the chart, such as chart typ, data, axis
>> labels etc.
>> > Many thanks in advance!
>> >
>> > seha
>> >
>> > Jason Weathersby wrote on Wed, 05 October 2011 17:40
>> >> Are you talking about on the StartData event?
>> >> If so you can always check the the type of
>> >>
>> >> public void startData( IDataContent data )
>> >> { {
>> >> Object mydata = data.getValue();
>> >>
>> >> if( mydata instanceof Integer){
>> >>
>> >>
>> >> }
>> >> ...
>> >>
>> >> On checking a table vs crosstab vs grid use the getGenerateBy call see
>> >> below.
>> >>
>> >>
>> >> public void startTable( ITableContent table )
>> >> {
>> >> assert table != null;
>> >> Object generatedBy = table.getGenerateBy();
>> >>
>> >> if( generatedBy instanceof TableItemDesign ){
>> >> //ExtendedItemDesign
>> >> //GridItemDesign
>> >>
>> >> }
>> >>
>> >>
>> >> You could also call the data engine and get the data for the table
>> like:
>> >>
>> >> public void startTable( ITableContent table )
>> >> {
>> >> assert table != null;
>> >> Object generatedBy = table.getGenerateBy();
>> >>
>> >> if( generatedBy instanceof TableItemDesign ){
>> >> //ExtendedItemDesign
>> >> //GridItemDesign
>> >> System.out.println("Table Instance");
>> >> IDataQueryDefinition idqd = ((TableItemDesign)
>> generatedBy).getQuery();
>> >>
>> >>
>> >> ExecutionContext exeContext = ( (ReportContent)
>> >> table.getReportContent( ) ).getExecutionContext( );
>> >>
>> >> try {
>> >> IDataEngine de = (IDataEngine) exeContext.getDataEngine();
>> >>
>> >> //org.eclipse.birt.report.engine.data.dte.QueryResultSet
>> >> QueryResultSet qr = (QueryResultSet) de.execute( idqd );
>> >>
>> >>
>> >>
>> >> IResultIterator ri = qr.getResultIterator( );
>> >> int cc = ri.getResultMetaData().getColumnCount();
>> >> IResultMetaData rsmd = ri.getResultMetaData();
>> >>
>> >>
>> >> while ( ri.next( ) )
>> >> {
>> >>
>> >>
>> >> for ( int i = 0; i < cc; i++ )
>> >> System.out.print(ri.getValue(rsmd.getColumnName(i+1)) + " ");
>> >>
>> >> System.out.println("");
>> >> }
>> >>
>> >> ri.close( );
>> >> qr.close( );
>> >>
>> >> } catch (EngineException e2) {
>> >> // TODO Auto-generated catch block
>> >> e2.printStackTrace();
>> >> } catch (BirtException e2) {
>> >> // TODO Auto-generated catch block
>> >> e2.printStackTrace();
>> >> }
>> >>
>> >> }
>> >>
>> >>
>> >> But this only gives you the table bindings which may be more than what
>> >> is displayed in the table.
>> >>
>> >> Jason
>> >>
>> >> On 10/5/2011 4:16 PM, seha wrote:
>> >> > Hallo all!
>> >> >
>> >> > I'm quite new to Birt. I started writing a new custom emitter for
>> Birt
>> >> > based on the book Integrating and Extending BIRT (3rd edition).
>> >> >
>> >> > How can I get the native data types (String, Interger,
>> Decimal...) of
>> >> > content passed to an emitter or the data type of the column? I know
>> >> that
>> >> > is possible to get this information by using IDataExtractionTask,
>> but
>> >> > how can I do this in my emitter class?
>> >> >
>> >> > The other thing is that the startTable event starts for grids,
>> tables
>> >> > and crosstabs. Is there any possibility to distinguish between table
>> >> and
>> >> > crosstab?
>> >> >
>> >> > Many thanks!
>> >> > seha
>> >
>> >
>
>

Re: Custom emitter: Get Data Types &amp;amp;amp;amp; startTable Event [message #735374 is a reply to message #735341] Tue, 11 October 2011 15:25 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

What plugin dependencies do you have. Mine has these:

Require-Bundle: org.eclipse.birt.report.engine,
com.ibm.icu,
org.eclipse.birt.data"


Jason

On 10/11/2011 10:58 AM, seha wrote:
> Hi Jason,
>
> I tried to get the data, but it doesn't work because the
> IDataQueryDefinition type is missing in the 2.6.0 version. Do you have
> any further suggestion?
>
> seha
>
> Jason Weathersby wrote on Fri, 07 October 2011 10:36
>> I believe you can get it like:
>>
>> ExtendedItemDesign mychart = (ExtendedItemDesign) image.getGenerateBy();
>>
>>
>> IDataQueryDefinition qd = mychart.getQuery();
>> try {
>> IDataEngine de = (IDataEngine) exeContext.getDataEngine();
>>
>> //org.eclipse.birt.report.engine.data.dte.QueryResultSet
>> QueryResultSet qr = (QueryResultSet) de.execute( qd );
>>
>>
>>
>> IResultIterator ri = qr.getResultIterator( );
>> int cc = ri.getResultMetaData().getColumnCount();
>> IResultMetaData rsmd = ri.getResultMetaData();
>>
>>
>> while ( ri.next( ) )
>> {
>>
>>
>> for ( int i = 0; i < cc; i++ )
>> System.out.print(ri.getValue(rsmd.getColumnName(i+1)) + " ");
>>
>> System.out.println("");
>> }
>>
>> ri.close( );
>> qr.close( );
>>
>> } catch (EngineException e2) {
>> // TODO Auto-generated catch block
>> e2.printStackTrace();
>> } catch (BirtException e2) {
>> // TODO Auto-generated catch block
>> e2.printStackTrace();
>> }
>>
>>
>>
>> Jason
>>
>> On 10/6/2011 6:00 PM, seha wrote:
>> > Hi Jason,
>> >
>> > many thanks for your valuable hint!
>> >
>> > My primary task is to map report items to javascript widgets and
>> > therefore I need to have all required information. In case that for
>> some
>> > reason your hint is not the right approach in my case, do you see any
>> > other posibility to get the information about the charts?
>> >
>> > Do I always have to use the Data Engine API to get the data related
>> to a
>> > report item?
>> > Can I also use the Design Engine API? How does it work for charts?
>> > Thanks in advance!
>> >
>> > seha
>> >
>> >
>> > Jason Weathersby wrote on Thu, 06 October 2011 11:45
>> >> Not sure if it will help but you can get the chart design like:
>> >>
>> >> public void startImage( IImageContent image )
>> >> {
>> >>
>> >> Object genby = image.getGenerateBy();
>> >> if( genby instanceof ExtendedItemDesign){
>> >>
>> >> ExtendedItemDesign mychart = (ExtendedItemDesign)
>> image.getGenerateBy();
>> >> long deh = mychart.getHandle().getID();
>> >> ReportDesignHandle rdh =
>> >> image.getReportContent().getDesign().getReportDesign();
>> >>
>> >>
>> >> //ExtendedItemHandle eih = (ExtendedItemHandle) rdh.getBody(
>> >> ).getContents( ).get( 0 );
>> >> ExtendedItemHandle eih = (ExtendedItemHandle) rdh.getElementByID(deh);
>> >>
>> >> try {
>> >> Chart cm = (Chart) eih.getReportItem( ).getProperty(
>> "chart.instance" );
>> >> //use chart api to retrieve chart design properties
>> >>
>> >> System.out.println("test");
>> >> } catch (ExtendedElementException e) {
>> >> // TODO Auto-generated catch block
>> >> e.printStackTrace();
>> >> }
>> >> Jason
>> >>
>> >> On 10/5/2011 8:12 PM, seha wrote:
>> >> > Hi Jason,
>> >> >
>> >> > thank you so much for your answer! That's exactly what I need.
>> >> >
>> >> >
>> >> > My approach was
>> >> > public void startData( IDataContent data ){
>> >> >
>> >> > if(data.getValue() != null){
>> >> > System.out.println(data.getValue().getClass().getSimpleName());
>> >> >
>> >> > } ...
>> >> >
>> >> > I thought there is a direct way to obtain information about the
>> native
>> >> > data type, so I spent a lot of time searching in vain.
>> >> > I still don't have any idea how to map the charts because they are
>> >> > passed to an emitter as images (startImage event). Is it possible to
>> >> get
>> >> > the information about the chart, such as chart typ, data, axis
>> >> labels etc.
>> >> > Many thanks in advance!
>> >> >
>> >> > seha
>> >> >
>> >> > Jason Weathersby wrote on Wed, 05 October 2011 17:40
>> >> >> Are you talking about on the StartData event?
>> >> >> If so you can always check the the type of
>> >> >>
>> >> >> public void startData( IDataContent data )
>> >> >> { {
>> >> >> Object mydata = data.getValue();
>> >> >>
>> >> >> if( mydata instanceof Integer){
>> >> >>
>> >> >>
>> >> >> }
>> >> >> ...
>> >> >>
>> >> >> On checking a table vs crosstab vs grid use the getGenerateBy
>> call see
>> >> >> below.
>> >> >>
>> >> >>
>> >> >> public void startTable( ITableContent table )
>> >> >> {
>> >> >> assert table != null;
>> >> >> Object generatedBy = table.getGenerateBy();
>> >> >>
>> >> >> if( generatedBy instanceof TableItemDesign ){
>> >> >> //ExtendedItemDesign
>> >> >> //GridItemDesign
>> >> >>
>> >> >> }
>> >> >>
>> >> >>
>> >> >> You could also call the data engine and get the data for the table
>> >> like:
>> >> >>
>> >> >> public void startTable( ITableContent table )
>> >> >> {
>> >> >> assert table != null;
>> >> >> Object generatedBy = table.getGenerateBy();
>> >> >>
>> >> >> if( generatedBy instanceof TableItemDesign ){
>> >> >> //ExtendedItemDesign
>> >> >> //GridItemDesign
>> >> >> System.out.println("Table Instance");
>> >> >> IDataQueryDefinition idqd = ((TableItemDesign)
>> >> generatedBy).getQuery();
>> >> >>
>> >> >>
>> >> >> ExecutionContext exeContext = ( (ReportContent)
>> >> >> table.getReportContent( ) ).getExecutionContext( );
>> >> >>
>> >> >> try {
>> >> >> IDataEngine de = (IDataEngine) exeContext.getDataEngine();
>> >> >>
>> >> >> //org.eclipse.birt.report.engine.data.dte.QueryResultSet
>> >> >> QueryResultSet qr = (QueryResultSet) de.execute( idqd );
>> >> >>
>> >> >>
>> >> >>
>> >> >> IResultIterator ri = qr.getResultIterator( );
>> >> >> int cc = ri.getResultMetaData().getColumnCount();
>> >> >> IResultMetaData rsmd = ri.getResultMetaData();
>> >> >>
>> >> >>
>> >> >> while ( ri.next( ) )
>> >> >> {
>> >> >>
>> >> >>
>> >> >> for ( int i = 0; i < cc; i++ )
>> >> >> System.out.print(ri.getValue(rsmd.getColumnName(i+1)) + " ");
>> >> >>
>> >> >> System.out.println("");
>> >> >> }
>> >> >>
>> >> >> ri.close( );
>> >> >> qr.close( );
>> >> >>
>> >> >> } catch (EngineException e2) {
>> >> >> // TODO Auto-generated catch block
>> >> >> e2.printStackTrace();
>> >> >> } catch (BirtException e2) {
>> >> >> // TODO Auto-generated catch block
>> >> >> e2.printStackTrace();
>> >> >> }
>> >> >>
>> >> >> }
>> >> >>
>> >> >>
>> >> >> But this only gives you the table bindings which may be more
>> than what
>> >> >> is displayed in the table.
>> >> >>
>> >> >> Jason
>> >> >>
>> >> >> On 10/5/2011 4:16 PM, seha wrote:
>> >> >> > Hallo all!
>> >> >> >
>> >> >> > I'm quite new to Birt. I started writing a new custom emitter for
>> >> Birt
>> >> >> > based on the book Integrating and Extending BIRT (3rd edition).
>> >> >> >
>> >> >> > How can I get the native data types (String, Interger,
>> >> Decimal...) of
>> >> >> > content passed to an emitter or the data type of the column? I
>> know
>> >> >> that
>> >> >> > is possible to get this information by using IDataExtractionTask,
>> >> but
>> >> >> > how can I do this in my emitter class?
>> >> >> >
>> >> >> > The other thing is that the startTable event starts for grids,
>> >> tables
>> >> >> > and crosstabs. Is there any possibility to distinguish between
>> table
>> >> >> and
>> >> >> > crosstab?
>> >> >> >
>> >> >> > Many thanks!
>> >> >> > seha
>> >> >
>> >> >
>> >
>> >
>
>
Re: Custom emitter: Get Data Types &amp;amp;amp;amp; startTable Event [message #735390 is a reply to message #735374] Tue, 11 October 2011 16:42 Go to previous messageGo to next message
seha Missing name is currently offline seha Missing name
Messages: 13
Registered: September 2011
Junior Member
Hi Jason,

thank you. It works now!

This is my preview result of the data set:
CUSTOMERNAME CONTACTLASTNAME CONTACTFIRSTNAME PHONE COUNTRY
Volvo Model
Replicas, Co Berglund Christina 0921-12 3555 Sweden

King Kong
Collectables, Co. Gao Mike +852 2251 1555 Hong Kong

Scandinavian Gift Ideas Larsson Martha 0695-34 6555 Sweden


I get this result by executing the code:

King Kong Collectables, Co., Gao, Mike, +852 2251 1555, Hong Kong, 1, 3
Volvo Model Replicas, Co, Berglund, Christina, 0921-12 3555, Sweden, 2, 3
Scandinavian Gift Ideas, Larsson, Martha, 0695-34 6555, Sweden, 2, 3

Do you have any idea what the last two columns stand for?

seha
Re: Custom emitter: Get Data Types &amp;amp;amp;amp; startTable Event [message #735477 is a reply to message #735390] Wed, 12 October 2011 00:17 Go to previous messageGo to next message
seha Missing name is currently offline seha Missing name
Messages: 13
Registered: September 2011
Junior Member
Hi Jason,

the last two columns are aggregation columns.
This is a little bit confusing because the aggregation was created in the footer row. Even though I removed the aggregation and refreshed the rptdesign file, the columns were still displayed. Moreover, they are still present in the rptdesign file.

Is this correct?

seha
Re: Custom emitter: Get Data Types &amp;amp;amp;amp;amp; startTable Event [message #735666 is a reply to message #735477] Wed, 12 October 2011 13:55 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

You have to remove them from the table bindings. Select the table and
clink on bindings tab and you will see them.

Jason

On 10/11/2011 8:17 PM, seha wrote:
> Hi Jason,
>
> the last two columns are aggregation columns.
> This is a little bit confusing because the aggregation was created in
> the footer row. Even though I removed the aggregation and refreshed the
> rptdesign file, the columns were still displayed. Moreover, they are
> still present in the rptdesign file.
>
> Is this correct?
>
> seha
Re: Custom emitter: Get Data Types &amp;amp;amp;amp;amp; startTable Event [message #735823 is a reply to message #735666] Wed, 12 October 2011 19:51 Go to previous messageGo to next message
seha Missing name is currently offline seha Missing name
Messages: 13
Registered: September 2011
Junior Member
Hi Jason,

thank you.
Is there any possibility to make this work by default?

seha

Jason Weathersby wrote on Wed, 12 October 2011 09:55
You have to remove them from the table bindings. Select the table and
clink on bindings tab and you will see them.

Jason

On 10/11/2011 8:17 PM, seha wrote:
> Hi Jason,
>
> the last two columns are aggregation columns.
> This is a little bit confusing because the aggregation was created in
> the footer row. Even though I removed the aggregation and refreshed the
> rptdesign file, the columns were still displayed. Moreover, they are
> still present in the rptdesign file.
>
> Is this correct?
>
> seha

Re: Custom emitter: Get Data Types &amp;amp;amp;amp;amp;amp; startTable Event [message #736101 is a reply to message #735823] Thu, 13 October 2011 15:13 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

I do not know of an easy way to do this.

Jason


On 10/12/2011 3:51 PM, seha wrote:
> Hi Jason,
>
> thank you. Is there any possibility to make this work by default?
>
> seha
>
> Jason Weathersby wrote on Wed, 12 October 2011 09:55
>> You have to remove them from the table bindings. Select the table and
>> clink on bindings tab and you will see them.
>>
>> Jason
>>
>> On 10/11/2011 8:17 PM, seha wrote:
>> > Hi Jason,
>> >
>> > the last two columns are aggregation columns.
>> > This is a little bit confusing because the aggregation was created in
>> > the footer row. Even though I removed the aggregation and refreshed the
>> > rptdesign file, the columns were still displayed. Moreover, they are
>> > still present in the rptdesign file.
>> >
>> > Is this correct?
>> >
>> > seha
>
>
Re: Custom emitter: Get Data Types &amp;amp;amp;amp;amp;amp; startTable Event [message #736160 is a reply to message #736101] Thu, 13 October 2011 17:38 Go to previous messageGo to next message
seha Missing name is currently offline seha Missing name
Messages: 13
Registered: September 2011
Junior Member
Hi Jason, thanks again.

When I execute the code to get data related to a table which has more than 50 rows, the startTable() event is fired after every 50th row?

Do you see any reasons for this?

By the way how does it work to get the data related to a crosstab?

Seha

Jason Weathersby wrote on Thu, 13 October 2011 11:13
I do not know of an easy way to do this.

Jason


On 10/12/2011 3:51 PM, seha wrote:
> Hi Jason,
>
> thank you. Is there any possibility to make this work by default?
>
> seha
>
> Jason Weathersby wrote on Wed, 12 October 2011 09:55
>> You have to remove them from the table bindings. Select the table and
>> clink on bindings tab and you will see them.
>>
>> Jason
>>
>> On 10/11/2011 8:17 PM, seha wrote:
>> > Hi Jason,
>> >
>> > the last two columns are aggregation columns.
>> > This is a little bit confusing because the aggregation was created in
>> > the footer row. Even though I removed the aggregation and refreshed the
>> > rptdesign file, the columns were still displayed. Moreover, they are
>> > still present in the rptdesign file.
>> >
>> > Is this correct?
>> >
>> > seha
>
>

[Updated on: Thu, 13 October 2011 17:45]

Report message to a moderator

Re: Custom emitter: Get Data Types &amp;amp;amp;amp;amp;amp;amp; startTable Event [message #736221 is a reply to message #736160] Thu, 13 October 2011 20:33 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

All the emitters in BIRT to output similar results. Ie pdf should look
very close to html etc. In order to do this emitters restart tables and
other list on page breaks. So your report is page breaking every 50th
row. If you output to html you will probably have 50 rows of data on
each page.

Jason

On 10/13/2011 1:38 PM, seha wrote:
> Hi Jason, thanks again.
>
> When I execute the code to get data related to a table which has more
> than 50 rows, the startTable() event is fired after every 50th row?
>
> Do you see any reasons for this?
> Seha
>
> Jason Weathersby wrote on Thu, 13 October 2011 11:13
>> I do not know of an easy way to do this.
>>
>> Jason
>>
>>
>> On 10/12/2011 3:51 PM, seha wrote:
>> > Hi Jason,
>> >
>> > thank you. Is there any possibility to make this work by default?
>> >
>> > seha
>> >
>> > Jason Weathersby wrote on Wed, 12 October 2011 09:55
>> >> You have to remove them from the table bindings. Select the table and
>> >> clink on bindings tab and you will see them.
>> >>
>> >> Jason
>> >>
>> >> On 10/11/2011 8:17 PM, seha wrote:
>> >> > Hi Jason,
>> >> >
>> >> > the last two columns are aggregation columns.
>> >> > This is a little bit confusing because the aggregation was
>> created in
>> >> > the footer row. Even though I removed the aggregation and
>> refreshed the
>> >> > rptdesign file, the columns were still displayed. Moreover, they are
>> >> > still present in the rptdesign file.
>> >> >
>> >> > Is this correct?
>> >> >
>> >> > seha
>> >
>> >
>
>
Re: Custom emitter: Get Data Types &amp;amp;amp;amp;amp;amp;amp; startTable Event [message #736307 is a reply to message #736221] Thu, 13 October 2011 22:30 Go to previous messageGo to next message
seha Missing name is currently offline seha Missing name
Messages: 13
Registered: September 2011
Junior Member
Hi Jason,

I see. Thank you!

Can you please tell me how does it work to get the data related to a crosstab?

Many thanks in advance.

Seha

Jason Weathersby wrote on Thu, 13 October 2011 16:33
All the emitters in BIRT to output similar results. Ie pdf should look
very close to html etc. In order to do this emitters restart tables and
other list on page breaks. So your report is page breaking every 50th
row. If you output to html you will probably have 50 rows of data on
each page.

Jason

On 10/13/2011 1:38 PM, seha wrote:
> Hi Jason, thanks again.
>
> When I execute the code to get data related to a table which has more
> than 50 rows, the startTable() event is fired after every 50th row?
>
> Do you see any reasons for this?
> Seha
>
> Jason Weathersby wrote on Thu, 13 October 2011 11:13
>> I do not know of an easy way to do this.
>>
>> Jason
>>
>>
>> On 10/12/2011 3:51 PM, seha wrote:
>> > Hi Jason,
>> >
>> > thank you. Is there any possibility to make this work by default?
>> >
>> > seha
>> >
>> > Jason Weathersby wrote on Wed, 12 October 2011 09:55
>> >> You have to remove them from the table bindings. Select the table and
>> >> clink on bindings tab and you will see them.
>> >>
>> >> Jason
>> >>
>> >> On 10/11/2011 8:17 PM, seha wrote:
>> >> > Hi Jason,
>> >> >
>> >> > the last two columns are aggregation columns.
>> >> > This is a little bit confusing because the aggregation was
>> created in
>> >> > the footer row. Even though I removed the aggregation and
>> refreshed the
>> >> > rptdesign file, the columns were still displayed. Moreover, they are
>> >> > still present in the rptdesign file.
>> >> >
>> >> > Is this correct?
>> >> >
>> >> > seha
>> >
>> >
>
>

Re: Custom emitter: Get Data Types &amp;amp;amp;amp;amp;amp;amp;amp; startTable Event [message #737053 is a reply to message #736307] Fri, 14 October 2011 15:56 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

The data will be available in startData for the data items in the
crosstab. You will know you are in a crosstab when the startTable is
called and you use the following code:

public void startTable( ITableContent table )
{
assert table != null;
Object generatedBy = table.getGenerateBy();
if( generatedBy instanceof ExtendedItemDesign ){
//in a crosstab

Jason

On 10/13/2011 6:30 PM, seha wrote:
> Hi Jason,
>
> I see. Thank you!
>
> Can you please tell me how does it work to get the data related to a
> crosstab?
>
> Many thanks in advance.
>
> Seha
>
> Jason Weathersby wrote on Thu, 13 October 2011 16:33
>> All the emitters in BIRT to output similar results. Ie pdf should look
>> very close to html etc. In order to do this emitters restart tables
>> and other list on page breaks. So your report is page breaking every
>> 50th row. If you output to html you will probably have 50 rows of data
>> on each page.
>>
>> Jason
>>
>> On 10/13/2011 1:38 PM, seha wrote:
>> > Hi Jason, thanks again.
>> >
>> > When I execute the code to get data related to a table which has more
>> > than 50 rows, the startTable() event is fired after every 50th row?
>> >
>> > Do you see any reasons for this?
>> > Seha
>> >
>> > Jason Weathersby wrote on Thu, 13 October 2011 11:13
>> >> I do not know of an easy way to do this.
>> >>
>> >> Jason
>> >>
>> >>
>> >> On 10/12/2011 3:51 PM, seha wrote:
>> >> > Hi Jason,
>> >> >
>> >> > thank you. Is there any possibility to make this work by default?
>> >> >
>> >> > seha
>> >> >
>> >> > Jason Weathersby wrote on Wed, 12 October 2011 09:55
>> >> >> You have to remove them from the table bindings. Select the
>> table and
>> >> >> clink on bindings tab and you will see them.
>> >> >>
>> >> >> Jason
>> >> >>
>> >> >> On 10/11/2011 8:17 PM, seha wrote:
>> >> >> > Hi Jason,
>> >> >> >
>> >> >> > the last two columns are aggregation columns.
>> >> >> > This is a little bit confusing because the aggregation was
>> >> created in
>> >> >> > the footer row. Even though I removed the aggregation and
>> >> refreshed the
>> >> >> > rptdesign file, the columns were still displayed. Moreover,
>> they are
>> >> >> > still present in the rptdesign file.
>> >> >> >
>> >> >> > Is this correct?
>> >> >> >
>> >> >> > seha
>> >> >
>> >> >
>> >
>> >
>
>
Re: Custom emitter: Get Data Types &amp;amp;amp;amp;amp;amp;amp;amp; startTable Event [message #737085 is a reply to message #737053] Fri, 14 October 2011 16:36 Go to previous messageGo to next message
seha Missing name is currently offline seha Missing name
Messages: 13
Registered: September 2011
Junior Member
Hi Jason,

sorry I didn't make myself clear. I want to get all the data at once.
I tried to do it the same way as for the table, but I couldn't find out how does it work with the CubeResultSet.


if( generatedBy instanceof ExtendedItemDesign ){
System.out.println("It's a crosstab");

IDataQueryDefinition idqd = ((ExtendedItemDesign) generatedBy).getQuery();
ExecutionContext exeContext = ( (ReportContent)
table.getReportContent( ) ).getExecutionContext( );
try {
IDataEngine de = (IDataEngine) exeContext.getDataEngine();

//org.eclipse.birt.report.engine.data.dte.QueryResultSet
CubeResultSet qr = (CubeResultSet) de.execute( idqd );
....


seha

Jason Weathersby wrote on Fri, 14 October 2011 11:56
The data will be available in startData for the data items in the
crosstab. You will know you are in a crosstab when the startTable is
called and you use the following code:

public void startTable( ITableContent table )
{
assert table != null;
Object generatedBy = table.getGenerateBy();
if( generatedBy instanceof ExtendedItemDesign ){
//in a crosstab

Jason

On 10/13/2011 6:30 PM, seha wrote:
> Hi Jason,
>
> I see. Thank you!
>
> Can you please tell me how does it work to get the data related to a
> crosstab?
>
> Many thanks in advance.
>
> Seha
>
> Jason Weathersby wrote on Thu, 13 October 2011 16:33
>> All the emitters in BIRT to output similar results. Ie pdf should look
>> very close to html etc. In order to do this emitters restart tables
>> and other list on page breaks. So your report is page breaking every
>> 50th row. If you output to html you will probably have 50 rows of data
>> on each page.
>>
>> Jason
>>
>> On 10/13/2011 1:38 PM, seha wrote:
>> > Hi Jason, thanks again.
>> >
>> > When I execute the code to get data related to a table which has more
>> > than 50 rows, the startTable() event is fired after every 50th row?
>> >
>> > Do you see any reasons for this?
>> > Seha
>> >
>> > Jason Weathersby wrote on Thu, 13 October 2011 11:13
>> >> I do not know of an easy way to do this.
>> >>
>> >> Jason
>> >>
>> >>
>> >> On 10/12/2011 3:51 PM, seha wrote:
>> >> > Hi Jason,
>> >> >
>> >> > thank you. Is there any possibility to make this work by default?
>> >> >
>> >> > seha
>> >> >
>> >> > Jason Weathersby wrote on Wed, 12 October 2011 09:55
>> >> >> You have to remove them from the table bindings. Select the
>> table and
>> >> >> clink on bindings tab and you will see them.
>> >> >>
>> >> >> Jason
>> >> >>
>> >> >> On 10/11/2011 8:17 PM, seha wrote:
>> >> >> > Hi Jason,
>> >> >> >
>> >> >> > the last two columns are aggregation columns.
>> >> >> > This is a little bit confusing because the aggregation was
>> >> created in
>> >> >> > the footer row. Even though I removed the aggregation and
>> >> refreshed the
>> >> >> > rptdesign file, the columns were still displayed. Moreover,
>> they are
>> >> >> > still present in the rptdesign file.
>> >> >> >
>> >> >> > Is this correct?
>> >> >> >
>> >> >> > seha
>> >> >
>> >> >
>> >
>> >
>
>

Re: Custom emitter: Get Data Types &amp;amp;amp;amp;amp;amp;amp;amp;amp; startTable Event [message #737144 is a reply to message #737085] Fri, 14 October 2011 18:00 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

I do not have an example of this as navigating the cube. I believe you
can get edge cursors

CubeResultSet qr = (CubeResultSet) de.execute( idqd );

ICubeCursor cursor = (ICubeCursor) qr.getCubeCursor( );
List oe =cursor.getOrdinateEdge();
EdgeCursor ec = (EdgeCursor) oe.get( 0 );

And use those. Take a look at CursorNavigatorTest.java in the
org.eclipse.birt.data.engine.olap.cursor package within the
org.eclipse.birt.data.engine.olap.cursor test package in the source tree.

Jason

On 10/14/2011 12:36 PM, seha wrote:
> Hi Jason,
>
> sorry I didn't make myself clear. I want to get all the data at once.
> I tried to do it the same way as for the table, but I couldn't find out
> how does it work with the CubeResultSet.
>
>
> if( generatedBy instanceof ExtendedItemDesign ){
> System.out.println("It's a crosstab");
>
> IDataQueryDefinition idqd = ((ExtendedItemDesign) generatedBy).getQuery();
> ExecutionContext exeContext = ( (ReportContent)
> table.getReportContent( ) ).getExecutionContext( );
> try {
> IDataEngine de = (IDataEngine) exeContext.getDataEngine();
>
> //org.eclipse.birt.report.engine.data.dte.QueryResultSet
> CubeResultSet qr = (CubeResultSet) de.execute( idqd ); ....
>
>
> seha
>
> Jason Weathersby wrote on Fri, 14 October 2011 11:56
>> The data will be available in startData for the data items in the
>> crosstab. You will know you are in a crosstab when the startTable is
>> called and you use the following code:
>>
>> public void startTable( ITableContent table )
>> {
>> assert table != null;
>> Object generatedBy = table.getGenerateBy();
>> if( generatedBy instanceof ExtendedItemDesign ){
>> //in a crosstab
>>
>> Jason
>>
>> On 10/13/2011 6:30 PM, seha wrote:
>> > Hi Jason,
>> >
>> > I see. Thank you!
>> >
>> > Can you please tell me how does it work to get the data related to a
>> > crosstab?
>> >
>> > Many thanks in advance.
>> >
>> > Seha
>> >
>> > Jason Weathersby wrote on Thu, 13 October 2011 16:33
>> >> All the emitters in BIRT to output similar results. Ie pdf should look
>> >> very close to html etc. In order to do this emitters restart tables
>> >> and other list on page breaks. So your report is page breaking every
>> >> 50th row. If you output to html you will probably have 50 rows of data
>> >> on each page.
>> >>
>> >> Jason
>> >>
>> >> On 10/13/2011 1:38 PM, seha wrote:
>> >> > Hi Jason, thanks again.
>> >> >
>> >> > When I execute the code to get data related to a table which has
>> more
>> >> > than 50 rows, the startTable() event is fired after every 50th row?
>> >> >
>> >> > Do you see any reasons for this?
>> >> > Seha
>> >> >
>> >> > Jason Weathersby wrote on Thu, 13 October 2011 11:13
>> >> >> I do not know of an easy way to do this.
>> >> >>
>> >> >> Jason
>> >> >>
>> >> >>
>> >> >> On 10/12/2011 3:51 PM, seha wrote:
>> >> >> > Hi Jason,
>> >> >> >
>> >> >> > thank you. Is there any possibility to make this work by default?
>> >> >> >
>> >> >> > seha
>> >> >> >
>> >> >> > Jason Weathersby wrote on Wed, 12 October 2011 09:55
>> >> >> >> You have to remove them from the table bindings. Select the
>> >> table and
>> >> >> >> clink on bindings tab and you will see them.
>> >> >> >>
>> >> >> >> Jason
>> >> >> >>
>> >> >> >> On 10/11/2011 8:17 PM, seha wrote:
>> >> >> >> > Hi Jason,
>> >> >> >> >
>> >> >> >> > the last two columns are aggregation columns.
>> >> >> >> > This is a little bit confusing because the aggregation was
>> >> >> created in
>> >> >> >> > the footer row. Even though I removed the aggregation and
>> >> >> refreshed the
>> >> >> >> > rptdesign file, the columns were still displayed. Moreover,
>> >> they are
>> >> >> >> > still present in the rptdesign file.
>> >> >> >> >
>> >> >> >> > Is this correct?
>> >> >> >> >
>> >> >> >> > seha
>> >> >> >
>> >> >> >
>> >> >
>> >> >
>> >
>> >
>
>
Re: Custom emitter: Get Data Types &amp;amp;amp;amp;amp;amp;amp;amp;amp; startTable Event [message #737673 is a reply to message #737144] Sat, 15 October 2011 09:36 Go to previous message
seha Missing name is currently offline seha Missing name
Messages: 13
Registered: September 2011
Junior Member
Hi Jason,

thank you for the answer.

seha

Jason Weathersby wrote on Fri, 14 October 2011 14:00
I do not have an example of this as navigating the cube. I believe you
can get edge cursors

CubeResultSet qr = (CubeResultSet) de.execute( idqd );

ICubeCursor cursor = (ICubeCursor) qr.getCubeCursor( );
List oe =cursor.getOrdinateEdge();
EdgeCursor ec = (EdgeCursor) oe.get( 0 );

And use those. Take a look at CursorNavigatorTest.java in the
org.eclipse.birt.data.engine.olap.cursor package within the
org.eclipse.birt.data.engine.olap.cursor test package in the source tree.

Jason

On 10/14/2011 12:36 PM, seha wrote:
> Hi Jason,
>
> sorry I didn't make myself clear. I want to get all the data at once.
> I tried to do it the same way as for the table, but I couldn't find out
> how does it work with the CubeResultSet.
>
>
> if( generatedBy instanceof ExtendedItemDesign ){
> System.out.println("It's a crosstab");
>
> IDataQueryDefinition idqd = ((ExtendedItemDesign) generatedBy).getQuery();
> ExecutionContext exeContext = ( (ReportContent)
> table.getReportContent( ) ).getExecutionContext( );
> try {
> IDataEngine de = (IDataEngine) exeContext.getDataEngine();
>
> //org.eclipse.birt.report.engine.data.dte.QueryResultSet
> CubeResultSet qr = (CubeResultSet) de.execute( idqd ); ....
>
>
> seha
>
> Jason Weathersby wrote on Fri, 14 October 2011 11:56
>> The data will be available in startData for the data items in the
>> crosstab. You will know you are in a crosstab when the startTable is
>> called and you use the following code:
>>
>> public void startTable( ITableContent table )
>> {
>> assert table != null;
>> Object generatedBy = table.getGenerateBy();
>> if( generatedBy instanceof ExtendedItemDesign ){
>> //in a crosstab
>>
>> Jason
>>
>> On 10/13/2011 6:30 PM, seha wrote:
>> > Hi Jason,
>> >
>> > I see. Thank you!
>> >
>> > Can you please tell me how does it work to get the data related to a
>> > crosstab?
>> >
>> > Many thanks in advance.
>> >
>> > Seha
>> >
>> > Jason Weathersby wrote on Thu, 13 October 2011 16:33
>> >> All the emitters in BIRT to output similar results. Ie pdf should look
>> >> very close to html etc. In order to do this emitters restart tables
>> >> and other list on page breaks. So your report is page breaking every
>> >> 50th row. If you output to html you will probably have 50 rows of data
>> >> on each page.
>> >>
>> >> Jason
>> >>
>> >> On 10/13/2011 1:38 PM, seha wrote:
>> >> > Hi Jason, thanks again.
>> >> >
>> >> > When I execute the code to get data related to a table which has
>> more
>> >> > than 50 rows, the startTable() event is fired after every 50th row?
>> >> >
>> >> > Do you see any reasons for this?
>> >> > Seha
>> >> >
>> >> > Jason Weathersby wrote on Thu, 13 October 2011 11:13
>> >> >> I do not know of an easy way to do this.
>> >> >>
>> >> >> Jason
>> >> >>
>> >> >>
>> >> >> On 10/12/2011 3:51 PM, seha wrote:
>> >> >> > Hi Jason,
>> >> >> >
>> >> >> > thank you. Is there any possibility to make this work by default?
>> >> >> >
>> >> >> > seha
>> >> >> >
>> >> >> > Jason Weathersby wrote on Wed, 12 October 2011 09:55
>> >> >> >> You have to remove them from the table bindings. Select the
>> >> table and
>> >> >> >> clink on bindings tab and you will see them.
>> >> >> >>
>> >> >> >> Jason
>> >> >> >>
>> >> >> >> On 10/11/2011 8:17 PM, seha wrote:
>> >> >> >> > Hi Jason,
>> >> >> >> >
>> >> >> >> > the last two columns are aggregation columns.
>> >> >> >> > This is a little bit confusing because the aggregation was
>> >> >> created in
>> >> >> >> > the footer row. Even though I removed the aggregation and
>> >> >> refreshed the
>> >> >> >> > rptdesign file, the columns were still displayed. Moreover,
>> >> they are
>> >> >> >> > still present in the rptdesign file.
>> >> >> >> >
>> >> >> >> > Is this correct?
>> >> >> >> >
>> >> >> >> > seha
>> >> >> >
>> >> >> >
>> >> >
>> >> >
>> >
>> >
>
>

Previous Topic:Populate HTML list box with the values from a Data set
Next Topic:Line Chart- how to cut Time Value from Date for Series Labeles
Goto Forum:
  


Current Time: Sat Oct 25 09:36:04 GMT 2014

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

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