Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Chart Axis script not working
Chart Axis script not working [message #900811] Wed, 08 August 2012 14:52 Go to next message
Michael Harless is currently offline Michael HarlessFriend
Messages: 14
Registered: January 2012
Junior Member
I am utilizing a script and a parameter to change the X axis on a chart that I am tasked with creating. It works beautifully in BIRT, but when I publish it to our EssentiaRX system, it gives this error message:

"TypeError: Cannot call method "getReportItem" of null (/report/method[@name="beforeFactory"]#5)."

Here is the script:

importPackage( Packages. org.eclipse.birt.chart.model);
importPackage (Packages.org.eclipse.birt.chart.model.attribute );

cht = reportContext.getDesignHandle().findElement("mychart1");
mychart = cht.getReportItem().getProperty( "chart.instance" );

xAxis =mychart.getAxes().get(0);
xSeriesDef = xAxis.getSeriesDefinitions().get(0);
xGrouping = xSeriesDef.getGrouping();

if (params["Period"].value == "Week"){
xGrouping.setGroupingUnit(GroupingUnitType.WEEKS_LITERAL);
}
else if (params["Period"].value == "Month"){
xGrouping.setGroupingUnit(GroupingUnitType.MONTHS_LITERAL);
}
else if (params["Period"].value == "Year"){
xGrouping.setGroupingUnit(GroupingUnitType.YEARS_LITERAL);
}


We are using BIRT 2.3.1 in Eclipse 3.4.1 as near as I can tell. Thanks for any assistance.
Re: Chart Axis script not working [message #900835 is a reply to message #900811] Wed, 08 August 2012 16:36 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Michael

What version of the designer did you test this in? Can you modify the
script like:

cht =
reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("mychart1");

I do not remember when we added the reportContext.getDesignHandle()
direct call but your version may not have the call.

Jason

On 8/8/2012 10:52 AM, Michael Harless wrote:
> I am utilizing a script and a parameter to change the X axis on a chart
> that I am tasked with creating. It works beautifully in BIRT, but when
> I publish it to our EssentiaRX system, it gives this error message:
>
> "TypeError: Cannot call method "getReportItem" of null
> (/report/method[@name="beforeFactory"]#5)."
>
> Here is the script:
>
> importPackage( Packages. org.eclipse.birt.chart.model);
> importPackage (Packages.org.eclipse.birt.chart.model.attribute );
>
> cht = reportContext.getDesignHandle().findElement("mychart1");
> mychart = cht.getReportItem().getProperty( "chart.instance" );
>
> xAxis =mychart.getAxes().get(0);
> xSeriesDef = xAxis.getSeriesDefinitions().get(0);
> xGrouping = xSeriesDef.getGrouping();
>
> if (params["Period"].value == "Week"){
> xGrouping.setGroupingUnit(GroupingUnitType.WEEKS_LITERAL);
> }
> else if (params["Period"].value == "Month"){
> xGrouping.setGroupingUnit(GroupingUnitType.MONTHS_LITERAL);
> }
> else if (params["Period"].value == "Year"){
> xGrouping.setGroupingUnit(GroupingUnitType.YEARS_LITERAL);
> }
>
> We are using BIRT 2.3.1 in Eclipse 3.4.1 as near as I can tell. Thanks
> for any assistance.
Re: Chart Axis script not working [message #900845 is a reply to message #900835] Wed, 08 August 2012 17:24 Go to previous messageGo to next message
Michael Harless is currently offline Michael HarlessFriend
Messages: 14
Registered: January 2012
Junior Member
Jason,

Thanks for the quick reply. Straight off of my screen: BIRT Report Designer, Version: 2.3.1.v20080630-7X7n7FECLqlyX1jw48bOyH4E0ha5, Build id: v20080922-1151.

I tried the code that you suggested and again, it worked fine in the designer, but when published into our EssentiaRX system, it gives the same error as before.

Perhaps I need to speak to those folks?

Mike

[Updated on: Wed, 08 August 2012 17:25]

Report message to a moderator

Re: Chart Axis script not working [message #900846 is a reply to message #900845] Wed, 08 August 2012 17:29 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you post the report?

On 8/8/2012 1:24 PM, Michael Harless wrote:
> Jason,
>
> Thanks for the quick reply. Straight off of my screen: BIRT Report
> Designer, Version: 2.3.1.v20080630-7X7n7FECLqlyX1jw48bOyH4E0ha5, Build
> id: v20080922-1151.
>
> I tried the code that you suggested and again, it worked fine in the
> designer, but when published into our EssentiaRX system, it gives the
> same error as before.
>
> Mike
Re: Chart Axis script not working [message #900848 is a reply to message #900846] Wed, 08 August 2012 17:32 Go to previous messageGo to next message
Michael Harless is currently offline Michael HarlessFriend
Messages: 14
Registered: January 2012
Junior Member
Sure, here it is:

Mike
Re: Chart Axis script not working [message #900850 is a reply to message #900846] Wed, 08 August 2012 17:32 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Also can you add this to the script?


cht = reportContext.getDesignHandle().findElement("mychart1");

importPackage( Packages.java.io );
out = new PrintWriter( new FileWriter( "c:/temp/chtevents.txt", true ) );
out.println( "Test " + cht);
out.close();

And post what is in chtevents.txt after running on the server.

Jason




On 8/8/2012 1:29 PM, Jason Weathersby wrote:
> Can you post the report?
>
> On 8/8/2012 1:24 PM, Michael Harless wrote:
>> Jason,
>>
>> Thanks for the quick reply. Straight off of my screen: BIRT Report
>> Designer, Version: 2.3.1.v20080630-7X7n7FECLqlyX1jw48bOyH4E0ha5, Build
>> id: v20080922-1151.
>>
>> I tried the code that you suggested and again, it worked fine in the
>> designer, but when published into our EssentiaRX system, it gives the
>> same error as before.
>>
>> Mike
>
Re: Chart Axis script not working [message #900858 is a reply to message #900850] Wed, 08 August 2012 18:00 Go to previous messageGo to next message
Michael Harless is currently offline Michael HarlessFriend
Messages: 14
Registered: January 2012
Junior Member
Jason,

The Essentia system won't let me run that script. It doesn't know what c: is.
Re: Chart Axis script not working [message #900861 is a reply to message #900858] Wed, 08 August 2012 18:14 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Is this running on a unix box?

On 8/8/2012 2:00 PM, Michael Harless wrote:
> Jason,
>
> The Essentia system won't let me run that script. It doesn't know what
> c: is.
Re: Chart Axis script not working [message #900864 is a reply to message #900861] Wed, 08 August 2012 18:19 Go to previous messageGo to next message
Michael Harless is currently offline Michael HarlessFriend
Messages: 14
Registered: January 2012
Junior Member
IBM Power 7. It's a evolutionary child of the old AS/400 systems.
Re: Chart Axis script not working [message #900867 is a reply to message #900864] Wed, 08 August 2012 18:23 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Ok add a data item to the top of the report and set its expression to
mycht; Then change your script to:

cht = reportContext.getDesignHandle().findElement("mychart1");
mycht = cht;

Make sure to not put a var keyword in front of it. Run the report and
see what is in the label.

Jason

On 8/8/2012 2:19 PM, Michael Harless wrote:
> IBM Power 7. It's a evolutionary child of the old AS/400 systems.
Re: Chart Axis script not working [message #900871 is a reply to message #900867] Wed, 08 August 2012 18:39 Go to previous messageGo to next message
Michael Harless is currently offline Michael HarlessFriend
Messages: 14
Registered: January 2012
Junior Member
When I run it in BIRT:
org.eclipse.birt.report.model.api.ExtendedItemHandle@118efe2

When I run it in Essentia, nothing.
Re: Chart Axis script not working [message #900878 is a reply to message #900871] Wed, 08 August 2012 19:21 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I am not certain why this is happening but could you try adding:

importPackage(Packages.org.eclipse.birt.report.model.api) to the top of
the script and see if it makes a difference?

Jason

On 8/8/2012 2:39 PM, Michael Harless wrote:
> When I run it in BIRT:
> mailto:org.eclipse.birt.report.model.api.ExtendedItemHandle@118efe2
>
> When I run it in Essentia, nothing.
>
Re: Chart Axis script not working [message #900880 is a reply to message #900878] Wed, 08 August 2012 19:33 Go to previous messageGo to next message
Michael Harless is currently offline Michael HarlessFriend
Messages: 14
Registered: January 2012
Junior Member
Jason,

It didn't help. I'm still getting the same error. I think that we need to send a copy of this to LWSI and see if they can help. Thanks so much.

Mike
Re: Chart Axis script not working [message #900896 is a reply to message #900880] Wed, 08 August 2012 21:14 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Sounds like a good idea. Let us know what you find out.

Jason

On 8/8/2012 3:33 PM, Michael Harless wrote:
> Jason,
>
> It didn't help. I'm still getting the same error. I think that we need
> to send a copy of this to LWSI and see if they can help. Thanks so much.
>
> Mike
Previous Topic:CDT Custom build Option to be added in Projects Context Menu and run for Both MBS and Standard Make
Next Topic:Reg dynamic parameter
Goto Forum:
  


Current Time: Mon Dec 09 10:19:03 GMT 2024

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

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

Back to the top