In several articles and also in the default reports you have seen that script functions are widely. They cover utility aspects, data conversion or just error handling.
However, there is often the question where to put these script. In this article I would like to show at last two options.
1. In the Design
The simplest solution is to put reusable scripts into the design itself. For that purpose, open the design and switch into the "Script" tab. Make sure that the design is selected in the Outline view, he "Scripts" tab is selection sensitive.
The drop down box offers several entry points. You can use the "initialize" one, that means the script is called when the report design is initialized. So its easy to define functions here that can be used later in other places of the report.

As you can see, I have just defined a single function func1(). I used that later exemplary in my design, for example in a dynamic text:

That gives in the end:

2. In Separate File
Second option you will also find in the default reports is to put scripts in separate files. Just create a file and put it next to the design (co-locate it there).

Now go to the properties view, select the design in the Outline view. Switch to the "Resources" tab and add the script to "Javascript Files".

Important: this works ONLY if you have configured BIRT "Shared Resource" location before. To do that, open the BIRT preferences and switch to "Report Design" -> "Resource". Navigate to the folder where your design is located,

In my example, the script and the design is located inside the project's config folder.
Happy Reporting
Jan