Integrate the report into a PHP application
You created a data source and at least one report design document. You can now add the necessary code to launch the report from a PHP application.
- If your data source needs to connect to a database, you need to establish the database connection.
- Configure the report.
In this example, the report is configured to be output to PDF.
// Configure the report $greRunnerObj = new FourjsReportRuntime($reportDesignFileName,"OrderReport\OrderReport"); $greRunnerObj->configureDistributedProcessing("127.0.0.1",7000); $greRunnerObj->selectDevice('PDF'); $greRunnerObj->selectPreview(false); $greRunnerObj->setOutputFileName($reportFileName);
- Instantiate the data source object from the data source
library.
// Run the report $reportData = new OrderReport\OrderReport($connection);
- Pass the object to the report engine for processing.
$greRunnerObj->run($reportData->getMasterRecord());