To incorporate the BIRT engine to a 4gl-based application, you need to write your 4gl source code and create and style your report.
Here you can find the source code for our basic examples, provided with some general explanations.
To create our own basic example, just copy the code to your .4gl source file.
import java java.util.logging.Level
import java org.eclipse.birt.core.framework.Platform
import java org.eclipse.birt.report.engine.api.EngineConfig
import java org.eclipse.birt.report.engine.api.HTMLRenderOption
import java org.eclipse.birt.report.engine.api.IReportEngine
import java org.eclipse.birt.report.engine.api.IReportEngineFactory
import java org.eclipse.birt.report.engine.api.IReportRunnable
import java org.eclipse.birt.report.engine.api.IRunAndRenderTask
define config EngineConfig
define factory IReportEngineFactory
define engine IReportEngine
define design IReportRunnable
define task IRunAndRenderTask
define html_opts HTMLRenderOption
define birt_home_dir string
For more details about the supported classes, refer here.
let birt_home_dir = fgl_getenv("LYCIA_DIR") || "\ReportEngine"
let config = EngineConfig.create()
call config.setBIRTHome(birt_home_dir)
call Platform.startup(config)
let factory = Platform.createFactoryObject("org.eclipse.birt.report.engine.ReportEngineFactory")
let engine = factory.createReportEngine(config)
calltask.setParameterValue("address_menu","Red%") -- Red% standing for any city starting with Red like Redmond
calltask.validateParameters()
Refer here to find out how to set parameters of the report.
In the simplest possible example - which supposes no reports - this step can be omitted.
Specify the name and (if necessary) format of the output file:
call task.setRenderOption(html_opts)
display"HTML render task is running..."
call task.run()
call task.close()
call engine.destroy()
call Platform.shutdown()
display "Report has been saved into file:"
display "C:\ProgramData\Querix\Lycia\progs\Birt_no_param.html"