Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » access report parameters from chart scripts
access report parameters from chart scripts [message #173457] Mon, 26 June 2006 16:14 Go to next message
Thomas Escolan is currently offline Thomas EscolanFriend
Messages: 101
Registered: July 2009
Senior Member
Hello,

Does someone know what is the easiest way to access the report parameters
within the chart script extension points (function beforeRendering(gcs,
context) in my case) ?
Thanks in advance, Thomas.
Re: access report parameters from chart scripts [message #173489 is a reply to message #173457] Mon, 26 June 2006 17:11 Go to previous messageGo to next message
David Michonneau is currently offline David MichonneauFriend
Messages: 1145
Registered: July 2009
Senior Member
Hi,

context.getExternalContext().getScriptable().getParameterVal ue( "paramName")
should work.

Thanks,

David

"Thomas Escolan" <thomas_escolan@yahoo.fr> wrote in message
news:3ffd171be790f611fd001d476e1c1810$1@www.eclipse.org...
> Hello,
>
> Does someone know what is the easiest way to access the report parameters
> within the chart script extension points (function beforeRendering(gcs,
> context) in my case) ?
> Thanks in advance, Thomas.
>
Re: access report parameters from chart scripts [message #173694 is a reply to message #173489] Tue, 27 June 2006 10:10 Go to previous messageGo to next message
Thomas Escolan is currently offline Thomas EscolanFriend
Messages: 101
Registered: July 2009
Senior Member
OK, thanks, so I did this in my chart scripts :


formatter = new java.text.SimpleDateFormat("HH:mm",
java.util.Locale.FRANCE);

function beforeRendering(gcs, context) {
var date =
context.getExternalContext().getScriptable().getParameterVal ue( "date");
if (date == null) {
date = new java.util.Date();
}

var chart = context.getChartInstance();
var title = chart.getTitle().getLabel().getCaption();
title.setValue(title.getValue() + " " + formatter.format((java.util.Date)
date));
}


BUT it fails on casting syntax (not supported, I guess) : is there a
clever way to do a call to ambiguously delcared methods ??

Thanks in advance, Thomas.
Re: access report parameters from chart scripts [message #173741 is a reply to message #173694] Tue, 27 June 2006 11:24 Go to previous messageGo to next message
David Michonneau is currently offline David MichonneauFriend
Messages: 1145
Registered: July 2009
Senior Member
Please check the Rhino syntax to see how to do this:
http://www.mozilla.org/rhino/

Thanks,

David

"Thomas Escolan" <thomas_escolan@yahoo.fr> wrote in message
news:1e24beca87adaaa6df759a05df2a3602$1@www.eclipse.org...
> OK, thanks, so I did this in my chart scripts :
>
>
> formatter = new java.text.SimpleDateFormat("HH:mm",
> java.util.Locale.FRANCE);
>
> function beforeRendering(gcs, context) {
> var date =
> context.getExternalContext().getScriptable().getParameterVal ue( "date");
> if (date == null) {
> date = new java.util.Date();
> }
>
> var chart = context.getChartInstance();
> var title = chart.getTitle().getLabel().getCaption();
> title.setValue(title.getValue() + " " + formatter.format((java.util.Date)
> date));
> }
>
>
> BUT it fails on casting syntax (not supported, I guess) : is there a
> clever way to do a call to ambiguously delcared methods ??
>
> Thanks in advance, Thomas.
>
Re: access report parameters from chart scripts [message #173747 is a reply to message #173741] Tue, 27 June 2006 11:43 Go to previous messageGo to next message
Thomas Escolan is currently offline Thomas EscolanFriend
Messages: 101
Registered: July 2009
Senior Member
Great ! Thank you, David.
Re: access report parameters from chart scripts [message #173761 is a reply to message #173747] Tue, 27 June 2006 12:47 Go to previous message
Thomas Escolan is currently offline Thomas EscolanFriend
Messages: 101
Registered: July 2009
Senior Member
For curious ones :

formatter = new java.text.SimpleDateFormat("HH:mm",
java.util.Locale.FRANCE);

function beforeRendering(gcs, context) {
var date =
context.getExternalContext().getScriptable().getParameterVal ue( "date");
if (date == null) {
date = new java.util.Date();
}

var chart = context.getChartInstance();
var title = chart.getTitle().getLabel().getCaption();
title.setValue(title.getValue() + " " +
formatter["format(java.util.Date)"](date));
}
Previous Topic:Transparent background in a graphic : bug ?
Next Topic:Dynamic Date formatting
Goto Forum:
  


Current Time: Sat Jul 27 12:53:20 GMT 2024

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

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

Back to the top