Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » External Scripts
External Scripts [message #554598] Mon, 23 August 2010 16:16 Go to next message
No real name is currently offline No real nameFriend
Messages: 18
Registered: April 2010
Junior Member
Hi,
can I use external Scripts in BIRT?
Currently I have created several Reports using mostly similar code. For better Maintenance I would like to externalize these scripts.

For example I am creating the SQL for my Data Sets with a script in the beforeOpen method using my parameters.
Now I want to take this script and save it under "sqlCreation.js" in a Folder "scripts" nearby the report. How can I now access this Script?

Thanks in advance!
Re: External Scripts [message #554605 is a reply to message #554598] Mon, 23 August 2010 16:36 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If you put your .js files in the resource folder and then add them to
the report this is possible. Look at the resources tab in the
properties editor when the root report is selected. There is an option
to use a .js file.

Jason

On 8/23/2010 12:16 PM, tobias.koehler1987@googlemail.com wrote:
> Hi,
> can I use external Scripts in BIRT?
> Currently I have created several Reports using mostly similar code. For
> better Maintenance I would like to externalize these scripts.
>
> For example I am creating the SQL for my Data Sets with a script in the
> beforeOpen method using my parameters. Now I want to take this script
> and save it under "sqlCreation.js" in a Folder "scripts" nearby the
> report. How can I now access this Script?
>
> Thanks in advance!
Re: External Scripts [message #554698 is a reply to message #554605] Tue, 24 August 2010 06:57 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 18
Registered: April 2010
Junior Member
Thank you!
The next step is assigning this JS file to a report Item. How can I do that?
I only found the Event Handler Item (which is just for Java classes I guess?)
Re: External Scripts [message #554857 is a reply to message #554698] Tue, 24 August 2010 14:16 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

You can call any function you define in the .js file from script, but
the call has to be placed in the event script tab. One option is to
build a template that has all the calls already in it and then use these
to start your development.

Jason

On 8/24/2010 2:57 AM, tobias.koehler1987@googlemail.com wrote:
> Thank you!
> The next step is assigning this JS file to a report Item. How can I do
> that? I only found the Event Handler Item (which is just for Java
> classes I guess?)
>
Re: External Scripts [message #1805646 is a reply to message #554857] Fri, 19 April 2019 14:09 Go to previous messageGo to next message
venkatesh veera is currently offline venkatesh veeraFriend
Messages: 5
Registered: November 2018
Junior Member
Hi jason,
Can you please elaborate the Above Explanation . i have added the .js File into the Resource tab but i am unable use the functions in the .js file. language i am using is java and EngineApi for report Creation


script.setContentType(DesignChoiceConstants.TEXT_CONTENT_TYPE_HTML);
    script.setContent("<script src=\"report.js\" >"+
        "</script>");

[Updated on: Fri, 19 April 2019 14:11]

Report message to a moderator

Re: External Scripts [message #1817101 is a reply to message #1805646] Fri, 15 November 2019 14:19 Go to previous message
Emanuele Spatola is currently offline Emanuele SpatolaFriend
Messages: 11
Registered: September 2019
Location: Italy
Junior Member
venkatesh veera wrote on Fri, 19 April 2019 16:09
Hi jason,
Can you please elaborate the Above Explanation . i have added the .js File into the Resource tab but i am unable use the functions in the .js file. language i am using is java and EngineApi for report Creation


script.setContentType(DesignChoiceConstants.TEXT_CONTENT_TYPE_HTML);
    script.setContent("<script src=\"report.js\" >"+
        "</script>");


Did you find any solution?
Previous Topic:Generate xlsx report using birt template and .csv file.
Next Topic:create Data Source with .csv
Goto Forum:
  


Current Time: Fri Apr 19 19:28:36 GMT 2024

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

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

Back to the top